Dear All,
This post explains how to setup ssh X11 forwarding. Please note that this post assumes that you have 2 machines running both with some linux installed.
The scenario:
I have 2 laptops - one connected via LAN and the other one via wifi but on the same network.
I have both laptops installed with Deb* based distro.
Need for ssh x11 forwarding:
1. Many a times when you have multiple systems connected via the same network, you may have to exchange files between them. Also there are scenarios where we have one laptop connected to speakers and the songs in some other laptop.
2. There are needs where in we may have to connect remotely to one of these machine to access some files, open them to edit and rest. We shall take up this scenario in one of the other posts pretty soon.
Pre-requisites:
Here there are 2 entities: (which we shall call them as)
1. Server laptop
2. Client laptop.
On both laptops, openssh client and server needs to be installed. Also make sure that xauth package is installed on the server laptop.
The commands to install these (for a fresh install)
sudo apt-get install openssh-client openssh-server xuath(xauth on the server laptop)
X11 forwarding configuration concepts:
On the server laptop:
1. Set a proper display with the command
export DISPLAY=:0
2. In the file /etc/ssh/ssh_config make sure this below entry is present or else un-comment the lines and change a no to yes as below:
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
3. In the file /etc/ssh/sshd_config (be careful with the file names) make sure this below entry is present or else un-comment the lines and change a no to yes except for the last line as below:
AllowAgentForwarding yes
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
4. Note down the IP address of this laptop with the command
ifconfig
For this post discussion we shall assume the IP as 192.168.1.8
5. Finally do not forget this step.. After setting the values do restart the ssh service with the below command:
sudo /etc/init.d/ssh restart
On the client laptop:
1. Connect to the server through a terminal/konsole and with the below command(note usage of putty ssh client is a different process altogether)
ssh user@192.168.1.2 -X (note to replace user with your name on the server laptop)
Give proper authentication credentials to login.
2. Once connected, issue the command,
export $DISPLAY
You should see some laptop / machine name with a display offset. (This is usually the hostname in most cases. )
3. If the output in step 2 is nil, then get back to the server and make sure all steps are properly implemented.
4. Finally verify (if not step 3), that X applications can be loaded easily with the commands:
xeyes or xlogo
5. If you get the output of xeyes or xlogo in step 4, you can also try editing an existing file or by creating a new file by the gedit or any other editor.
gedit a.txt
Finally mission accomplished.. Successful ssh x11 forwarding...
Thats it for now... Hope you had a good learning experience through this post.
Hope to write many more posts...
Tc,
Ananth G S
Friday, November 3, 2017
Thursday, October 26, 2017
Home Media Server with Kodi - a DIY
Dear All,
This post explains how to setup a "Home Media" server with Kodi and other tools.
Pre-requisites:
1. A good movie collection
2. A Linux installed OS
Installations:
1. XBMC / Kodi server (latest being called Krypton)
2. youtube-dl for downloading movies/video collection from youtube
3. ffmpeg and avconv for conversion processes.
4. openssh client and server tools for accessing the movie collection outside the network.
Installation of above in Ubuntu / Debian systems with working Internet connection is:
0. sudo apt-get update
1. sudo apt-get install kodi kodi-standalone
2. sudo apt-get install youtube-dl
3. sudo apt-get install ffmpeg avconv
4. sudo apt-get install openssh-client openssh-server
5. For any of the above commands failing to execute, issue sudo apt-get -f install
iOS and Android App
There is an Android and ios app with the name Kodi. Installation is through the play store or the app store.
Configuration settings and execution/launch of a movie in Kodi
Launch Kodi by the run prompt (Alt+F2) enter kodi
In the beginning screen you should see the Files Section. Browse to your movie collection and add the source.
Play any movie to see that the source is taken into consideration.
Note the file format of the movie has to be one of the many supported file formats of Kodi.
If for any failure of a movie file format,
You can redownload the movie with the command
1. youtube-dl --recode-video avi --prefer-ffmpeg URL
OR
2. youtube-dl --recode-video avi --prefer-avconv URL
Replace the URL with the link of the movie. Also make sure that both ffmepg and avconv are installed.
Now play the re-formatted file in Kodi to check for the proper format.
Enabling web server of Kodi and Zeroconf settings
Kodi has too many options and tweaks to help users. One such thing is enabling the webserver concept and allowing other apps to access kodi.
To enable both, hit Kodi Settings/Services/Control - enable Allow remote control via HTTP and give proper values and note the port number.
Also in Settings/Services/General/Zeroconf enable the first line.
Enabling the UPnP / DLNA support in Kodi
Kodi helps us to stream movies and music to the TV with a network connected in the Hall / living room. For this, Settings/Services/UPnP - enable the first 2 lines.
Accessing movie collection of Kodi - across the network
Though there are multiple ways of accessing the movie collection of Kodi across network, one thing that I could make it work easily is via ssh.
This below link is the best guide.
http://www.arbi.se/using-connectbot-for-ssh-with-pubkey-authentication/
After following the above link, make sure you port forward 22 port and also give appropriate values to the connect via SSH in Kodi in your android or ios device.
Note: Kodi by default connects to a Event Server with port 9777. Also Port forward 9090 and 9777 is important.
Kodi also by default connects to a wifi. If your laptop has both wifi and a RJ45 port, make sure wifi is disabled.
Kodi also makes use of ipv6 in original. Disable it. (Google out to know how to disable ipv6 in *Deb systems.)
Hope this blog post helped some of you stream your movie collection across multiple devices.
I shall continue this post with yet another tweaks related to Kodi pretty soon.
Thanks for reading,
Ananth G S
This post explains how to setup a "Home Media" server with Kodi and other tools.
Pre-requisites:
1. A good movie collection
2. A Linux installed OS
Installations:
1. XBMC / Kodi server (latest being called Krypton)
2. youtube-dl for downloading movies/video collection from youtube
3. ffmpeg and avconv for conversion processes.
4. openssh client and server tools for accessing the movie collection outside the network.
Installation of above in Ubuntu / Debian systems with working Internet connection is:
0. sudo apt-get update
1. sudo apt-get install kodi kodi-standalone
2. sudo apt-get install youtube-dl
3. sudo apt-get install ffmpeg avconv
4. sudo apt-get install openssh-client openssh-server
5. For any of the above commands failing to execute, issue sudo apt-get -f install
iOS and Android App
There is an Android and ios app with the name Kodi. Installation is through the play store or the app store.
Configuration settings and execution/launch of a movie in Kodi
Launch Kodi by the run prompt (Alt+F2) enter kodi
In the beginning screen you should see the Files Section. Browse to your movie collection and add the source.
Play any movie to see that the source is taken into consideration.
Note the file format of the movie has to be one of the many supported file formats of Kodi.
If for any failure of a movie file format,
You can redownload the movie with the command
1. youtube-dl --recode-video avi --prefer-ffmpeg URL
OR
2. youtube-dl --recode-video avi --prefer-avconv URL
Replace the URL with the link of the movie. Also make sure that both ffmepg and avconv are installed.
Now play the re-formatted file in Kodi to check for the proper format.
Enabling web server of Kodi and Zeroconf settings
Kodi has too many options and tweaks to help users. One such thing is enabling the webserver concept and allowing other apps to access kodi.
To enable both, hit Kodi Settings/Services/Control - enable Allow remote control via HTTP and give proper values and note the port number.
Also in Settings/Services/General/Zeroconf enable the first line.
Enabling the UPnP / DLNA support in Kodi
Kodi helps us to stream movies and music to the TV with a network connected in the Hall / living room. For this, Settings/Services/UPnP - enable the first 2 lines.
Accessing movie collection of Kodi - across the network
Though there are multiple ways of accessing the movie collection of Kodi across network, one thing that I could make it work easily is via ssh.
This below link is the best guide.
http://www.arbi.se/using-connectbot-for-ssh-with-pubkey-authentication/
After following the above link, make sure you port forward 22 port and also give appropriate values to the connect via SSH in Kodi in your android or ios device.
Note: Kodi by default connects to a Event Server with port 9777. Also Port forward 9090 and 9777 is important.
Kodi also by default connects to a wifi. If your laptop has both wifi and a RJ45 port, make sure wifi is disabled.
Kodi also makes use of ipv6 in original. Disable it. (Google out to know how to disable ipv6 in *Deb systems.)
Hope this blog post helped some of you stream your movie collection across multiple devices.
I shall continue this post with yet another tweaks related to Kodi pretty soon.
Thanks for reading,
Ananth G S
Thursday, October 19, 2017
AVD launch in Android Studio 2.3 and Ubuntu 17.04
Hello All,
For people who use Android Studio for Android programming and in the Ubuntu / Debian Environment, there was a recent problem loading a AVD in the latest 2.3 version.
This blog post helps you solve this peculiar problem.
The details:
1. You write some android code, and want to test with a AVD. You install the specific target machine, but after gradle build, the launch of AVD totally stops.
There is a timeout of about 300 seconds and the AVD fails to load.
One alternate method is to use your existing Android based smart phone and connect it with a USB cord.
The second approach is given below:
Issue this below command in bold and then restart Android Studio. The problem should be solved.
ln -sf /usr/lib/libstdc++.so.6 /your_sdk/emulator/lib64/libstdc++/libstdc++.so.6
Hope this helps you..
Tc,
Ananth G S
For people who use Android Studio for Android programming and in the Ubuntu / Debian Environment, there was a recent problem loading a AVD in the latest 2.3 version.
This blog post helps you solve this peculiar problem.
The details:
1. You write some android code, and want to test with a AVD. You install the specific target machine, but after gradle build, the launch of AVD totally stops.
There is a timeout of about 300 seconds and the AVD fails to load.
One alternate method is to use your existing Android based smart phone and connect it with a USB cord.
The second approach is given below:
Issue this below command in bold and then restart Android Studio. The problem should be solved.
ln -sf /usr/lib/libstdc++.so.6 /your_sdk/emulator/lib64/libstdc++/libstdc++.so.6
Make
sure to replace your_sdk above with your respective $ANDROID_SDK
path.
Tc,
Ananth G S
Tuesday, August 29, 2017
Firefox Flem - solving the problem of Bookmarks remotely..
Hello... Most of us have the practice of bookmarking webpages... This post does not explain how to import or export bookmarks..
Read full to know more..
Recently I faced a problem where in - I had to fetch my bookmarks from Google Chrome located at a remote machine. Unfortunately I had not taken a backup of my bookmarks.. Also I had only CLI ssh access to the machine..
What most of us do is that - we use browsers like Firefox and Chrome and we login to the browsers via an account(Chrome a/c for example) and that saves us from exports / import.
I dont have this practice.. So fetching my urls were much more difficult..
I googled to find out where the location of my bookmarks in Chrome stored in my /home location.
After finding it out... Which is: inside the respective home folder
.config/google-chrome/Default/Bookmarks [observe the . at the beginning]
I was kind of happy to find my Bookmarks.
2. The next problem was - the moment I gave cat Bookmarks
The file was in completely JSON format. I had around 97 URLs bookmarked.
3. How to fetch only the URLs from this file of JSON format was the next hurdle..
Shell commands to the rescue...
I issued the command:
cat Bookmarks | grep http
This output had enough amount of invalid characters as well... But it also fetched me https urls.. So the problem of http and https was solved..
Then the next command...
cat Bookmarks | grep http | wc -l [gave an output as 97 ]
4. Removing the invalid characters and only fetching the exact URL paths...
I now issued the command:
cat Bookmarks | grep http | cut -d : -f 2,3
This gave me all the list of URLs as 97 URLs.
5. Ok what next? How do I put them across to a text file?
It was pretty simple... cat Bookmarks | grep http | cut -d : -f 2,3 > urls.txt
... Concept of redirection..
6. Now how on earth would I put the urls.txt back to my existing browser in the local machine?
I cannot copy 97 URLs one after the other and save it yet again...?
7. Firefox Flem to the rescue..
This addon of Firefox can import a list of URLs or even a text file into its browser at one shot... !
Try Flem...
Let me know for any queries..
Tc,
Ananth G S
Read full to know more..
Recently I faced a problem where in - I had to fetch my bookmarks from Google Chrome located at a remote machine. Unfortunately I had not taken a backup of my bookmarks.. Also I had only CLI ssh access to the machine..
What most of us do is that - we use browsers like Firefox and Chrome and we login to the browsers via an account(Chrome a/c for example) and that saves us from exports / import.
I dont have this practice.. So fetching my urls were much more difficult..
I googled to find out where the location of my bookmarks in Chrome stored in my /home location.
After finding it out... Which is: inside the respective home folder
.config/google-chrome/Default/Bookmarks [observe the . at the beginning]
I was kind of happy to find my Bookmarks.
2. The next problem was - the moment I gave cat Bookmarks
The file was in completely JSON format. I had around 97 URLs bookmarked.
3. How to fetch only the URLs from this file of JSON format was the next hurdle..
Shell commands to the rescue...
I issued the command:
cat Bookmarks | grep http
This output had enough amount of invalid characters as well... But it also fetched me https urls.. So the problem of http and https was solved..
Then the next command...
cat Bookmarks | grep http | wc -l [gave an output as 97 ]
4. Removing the invalid characters and only fetching the exact URL paths...
I now issued the command:
cat Bookmarks | grep http | cut -d : -f 2,3
This gave me all the list of URLs as 97 URLs.
5. Ok what next? How do I put them across to a text file?
It was pretty simple... cat Bookmarks | grep http | cut -d : -f 2,3 > urls.txt
... Concept of redirection..
6. Now how on earth would I put the urls.txt back to my existing browser in the local machine?
I cannot copy 97 URLs one after the other and save it yet again...?
7. Firefox Flem to the rescue..
This addon of Firefox can import a list of URLs or even a text file into its browser at one shot... !
Try Flem...
Let me know for any queries..
Tc,
Ananth G S
Saturday, July 8, 2017
Canon LBP2900 driver installation - Arch Linux
Hi All,
This post explains how to setup CanonLBP2900 printer drivers in Arch Linux.
Installation of drivers:
1. You need the yaourt package manager (to install software for AUR)
2. Issue the command yaourt capt-src
This command installs the 2.7 version of CAPT drivers.
Configuration of the CUPS driver:
1. As we know CAPT has to sit on the CUPS driver. So make sure that CUPS is installed and configured properly.
To be on the safer side, you can issue the command:
sudo pacman -S cups
Then enable the cups driver by the command:
systemctl enable org.cups.cupsd.service
Then start the service:
systemctl start org.cups.cupsd.service
Check the status by:
systemctl status org.cups.cupsd.service (you should get active status with pid values)
Configuration of the CAPT driver:
2. Make sure that the user is added to both the groups - lp and sys
gpasswd -a ananth sys lp
3. Next make sure that the ppd is registered to the path
sudo /usr/sbin/lpadmin -p LBP2900 -m CNCUPSLBP2900CAPTK.ppd -v ccp://localhost:59687 -E
5. Start and enable the ccp daemon:
sudo systemctl enable ccpd.service
sudo systemctl start ccpd.service
sudo systemctl status ccpd.service (to check its running/active status)
This post explains how to setup CanonLBP2900 printer drivers in Arch Linux.
Installation of drivers:
1. You need the yaourt package manager (to install software for AUR)
2. Issue the command yaourt capt-src
This command installs the 2.7 version of CAPT drivers.
Configuration of the CUPS driver:
1. As we know CAPT has to sit on the CUPS driver. So make sure that CUPS is installed and configured properly.
To be on the safer side, you can issue the command:
sudo pacman -S cups
Then enable the cups driver by the command:
systemctl enable org.cups.cupsd.service
Then start the service:
systemctl start org.cups.cupsd.service
Check the status by:
systemctl status org.cups.cupsd.service (you should get active status with pid values)
Configuration of the CAPT driver:
2. Make sure that the user is added to both the groups - lp and sys
gpasswd -a ananth sys lp
3. Next make sure that the ppd is registered to the path
sudo /usr/sbin/lpadmin -p LBP2900 -m CNCUPSLBP2900CAPTK.ppd -v ccp://localhost:59687 -E
4. Check for the path where the printer has its device, register capt to cups through the usblp device
sudo /usr/sbin/ccpdadmin -p LBP2900 -o /dev/usb/lp1
5. Start and enable the ccp daemon:
sudo systemctl enable ccpd.service
sudo systemctl start ccpd.service
sudo systemctl status ccpd.service (to check its running/active status)
6. Check if its all working fine with
captstatusui -P LBP2900
Precaution commands:
Many a times, the printer might not work due to various reasons.
Steps / Commands to be followed then:
1. Reinstall CUPS
2. Reinstall CAPT
3. ls -l /var/ccp
4. sudo mkdir /var/ccpd
5. sudo mkfifo /var/ccpd/fifo0
6. sudo chown -R lp:lp /var/ccpd
7. sudo chown -R user_name:lp /var/ccpd (replace username with $LOGNAME)
8. ldd /usr/bin/captfilter (produces this below output)
linux-gate.so.1 (0xf76f7000)
libpopt.so.0 => /usr/lib32/libpopt.so.0 (0xf76b0000)
libc.so.6 => /usr/lib32/libc.so.6 (0xf74ef000)
/lib/ld-linux.so.2 (0xf76f9000)
9. ldd /usr/bin/capt* | sort | uniq | grep "not found" (should give you no output )
Last enable both cups and capt for startup by the command
sudo systemctl enable org.cups.cupsd.service
sudo systemctl enable ccpd.service
Hope this helps...
Tc,
Ananth G S
Sunday, June 18, 2017
Dual monitor display with Nouveau and xrandr
Hello fellas.... Its been a while blogging... I would not repeat this statement yet again... !
This post explains how to setup a dual monitor display with Nouveau open source drivers and using the tool xrandr.
Hardware:
1. Nvidia GT 730 with 3 outputs - HDMI, VGA and DVI.
Platform of setup:
1. 2 Dell monitors of 20" display (using only 1 as of now)
2. 1 TV (Vu 32 inches)
OS: Linux Sarah.
Tools and Drivers:
Nouveau open source graphics driver and xrandr
The problem statement:
If you already read my setup, my TV supports a stupid resolution of only 1360x768 where as my Dell monitor supports upto 1600x900 both in 60Hz. A xrandr query shows a much bigger resolution.
Each time I installed a OS and installed Nvidia proprietary drivers, I had enough difficulties to setup for a dual display - cos - when mirrored displays were used - both TV and Monitor would end up only with 1024x768 resolution.
Why not Nvidia?
1. The typical wrong misconception, that a VGA cable cannot be used to upgrade a resolution.
2. Being proprietary, it did not support xrandr properly (got Bad Mismatch errors)
The ultimate solution:
1. Uninstall all installed Nvidia drivers
2. Install Nouveau drivers.
Implementation of the solution:
1. sudo apt-get remove nvidia*
2. sudo apt-get purge nvidia*
3. sudo apt-get purge bumble*
4. sudo apt-get purge bbswitch
5. sudo apt-get --reinstall install xserver-xorg-video-nouveau
6. sudo apt-get --reinstall install nouveau-firmware
7. sudo dpkg-reconfigure xserver-xorg
8. sudo dpkg-reconfigure xserver-xorg-video-nouveau
9. Remove all blacklisted nouveau names in /etc/modprobe.d/ folder
10. Reboot - sudo reboot now
Make sure that both the monitors are connected through your graphics card outputs.
Once booted back - nouveau should automatically pickup the displays.
But the screen resolution problem is not yet solved: 1 screen shows 1600x900 and the other 1360x768
Solution: Use xrandr tool
Commands:
1. gtf 1600 900 60 -x
2. xrandr --newmode "1600x900_60.00" 119.00 1600 1696 1864 2128 900 901 904 932 -HSync +Vsync
3. xrandr --addmode VGA-1 1600x900_60.00
4. xrandr --output VGA-1 --mode 1600x900_60.00
Finally I can even get a high resolution of 1920x1200 !
If need be, you can convert the above 4 lines to a shell script and execute the script at each startup.
Tc..
Ananth G S
This post explains how to setup a dual monitor display with Nouveau open source drivers and using the tool xrandr.
Hardware:
1. Nvidia GT 730 with 3 outputs - HDMI, VGA and DVI.
Platform of setup:
1. 2 Dell monitors of 20" display (using only 1 as of now)
2. 1 TV (Vu 32 inches)
OS: Linux Sarah.
Tools and Drivers:
Nouveau open source graphics driver and xrandr
The problem statement:
If you already read my setup, my TV supports a stupid resolution of only 1360x768 where as my Dell monitor supports upto 1600x900 both in 60Hz. A xrandr query shows a much bigger resolution.
Each time I installed a OS and installed Nvidia proprietary drivers, I had enough difficulties to setup for a dual display - cos - when mirrored displays were used - both TV and Monitor would end up only with 1024x768 resolution.
Why not Nvidia?
1. The typical wrong misconception, that a VGA cable cannot be used to upgrade a resolution.
2. Being proprietary, it did not support xrandr properly (got Bad Mismatch errors)
The ultimate solution:
1. Uninstall all installed Nvidia drivers
2. Install Nouveau drivers.
Implementation of the solution:
1. sudo apt-get remove nvidia*
2. sudo apt-get purge nvidia*
3. sudo apt-get purge bumble*
4. sudo apt-get purge bbswitch
5. sudo apt-get --reinstall install xserver-xorg-video-nouveau
6. sudo apt-get --reinstall install nouveau-firmware
7. sudo dpkg-reconfigure xserver-xorg
8. sudo dpkg-reconfigure xserver-xorg-video-nouveau
9. Remove all blacklisted nouveau names in /etc/modprobe.d/ folder
10. Reboot - sudo reboot now
Make sure that both the monitors are connected through your graphics card outputs.
Once booted back - nouveau should automatically pickup the displays.
But the screen resolution problem is not yet solved: 1 screen shows 1600x900 and the other 1360x768
Solution: Use xrandr tool
Commands:
1. gtf 1600 900 60 -x
2. xrandr --newmode "1600x900_60.00" 119.00 1600 1696 1864 2128 900 901 904 932 -HSync +Vsync
3. xrandr --addmode VGA-1 1600x900_60.00
4. xrandr --output VGA-1 --mode 1600x900_60.00
Finally I can even get a high resolution of 1920x1200 !
Tc..
Ananth G S
Subscribe to:
Posts (Atom)