Sunday, November 17, 2019

networking - Ubuntu Server via LAN




I was wondering if the following would be possible (and hopefully get some pointers on how to get this done).



I would like to install Ubuntu Server on an old computer and be able to connect to it and browse files by connecting a LAN cable from my new computer. If possible, I'd like to have it accept all connections over LAN and only accept connections over LAN.



That is, I want to have some influence over files and software on the old computer without having a keyboard or screen connected to it.



Is this possible (and how would you go about it)?






Follow the instructions in How do I install Ubuntu Server (step-by-step)



Towards the end, at the Software Selection window:



enter image description here



Select Openssh Server, the first one in the image above. You will use ssh to connect to the server and interact with it. It will be a command line interface, as the server does not have any GUI.






I assume the new computer already has Ubuntu Desktop installed. The connection will be using a LAN cable. For simplicity, I assume it will be via a wired router. That is, both the computers are connected by LAN cables to a wired router.





Log in to the old computer terminal and enter:



ifconfig



You will see something like



eno1      Link encap:Ethernet  HWaddr 00:11:22:33:44:55  
inet addr:192.168.x.yyy Bcast:192.168.0.255 Mask:255.255.255.0


Note down the inet addr:. the x may be eitehr 0 or 1, and yyy will be another number. It is the local LAN IP address of your server. You will need this to connect to the old computer.



You will also need the user ID and password of the server in the old computer. You created these when you installed the Ubuntu server in the old computer.






Open a terminal in the new computer by pressing Ctrl+Alt+T and enter:



ssh server_user_ID@192.168.x.yyy


Note: use your own server's user ID and the IP address you noted down above.



You will be prompted for password. Enter your server user's password. Nothing will be seen on the terminal and the cursor will not move. This is normal.




If successful, you will see the command prompt change from the new computer's userID@NewComputer:~$ to ServerUserID@oldcomputer:~$.



If this step works, congratulations. You can control your old computer from the new computer.





Open Nautilus and find the Menu item "Connect to server".



enter image description here




Under Server Address Enter:



sftp://server_user_id@192.168.x.yyy/home/server_user_id



Press Connect. You will see a password dialog box:



enter image description here



Enter the password associated with server_user_id and select if you want the password is to be remembered or not. Again click Connect.




Now you should see your home folder of the laptop.



Notice there is a new entry under Network on the left panel of Nautilus that begins with server_user_id. Right click on it and choose "Add Bookmark" to create a permanent bookmark for your server's home folder in the Nautilus of the Desktop.



Now you can access the files and folders in your old computer from your new computer.



See the Ubuntu to Ubuntu section of How to share files through the local network? for more details.







  • Use public and private key pairs to login and disable password based login. Private/public keys are more secure than passwords, as they are harder to guess. This is not an issue if you only access your server from within your home. The default settings of your router should prevent any attempts from reaching the server from outside. See How can I set up password-less SSH login?

  • Network File System (NFS) can be used to attach the server folders to the desktop's system when the Desktop boots, assuming that the server is always running.



Thanks to muru for suggesting these topics in the comments.



Hope this helps


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...