w3resource logo


web-server

Remote administration ubuntu linux server

Secondary Nav

Remote administration with SSH

  • Ubuntu ships with an open source implementation of the SSH standard, called OpenSSH.
  • Using OpenSSH, you may securely control a remote computer, and transfer files.
  • For this, we must install the sshd component on the server if not already installed.

Install sshd

sudo apt-get install openssh-server
    Install the client component:

Some OS’s, like Mac OS X, come with an SSH client build-in. In Windows, use Putty. For Linux use the following command

sudo apt-get install openssh-client

Connect with SSH

Connect:

w3r:~ psr$ ssh [email protected]

Authenticate the client using its public key

To avoid providing it with password every time you connect, you may authenticate the client using its public key;

Create the client’s public key if one doesn’t exist already:

ssh-keygen -t dsa

This creates your key pair and stores it in ~/.ssh/.

Preparing client

Open the file "~/.ssh/id_dsa.pub", copy contents if the file on the client, and paste it in the file "~/.ssh/authorized_keys" on the server. If later one does not exist, you have to create it. You can view the contents of the file with following command:

$ cat authorized_keys
ssh-dss
AAAAB3NzaC1kc3MAAACBAPKXVOfOAXtN8USLGYWJ7eSvvmPOawSXq35v1xHlTYPBeYbcLD17saIL8Mv7qgb9YDlU
7qPSQgSlOupzWnS7NyXxY5o/G0Z55R7ELQe/MlsRllfdEgLJn/
o1ww97POqcwDNxtRH48Or2chS2nyJlRIrq4c4pIW71HX+TobuMiHk5AAAAFQD7OZHCLizY/
WaTML9pNm103Dv6ZQAAAIEArli/RfNDvFPMuusrzlSOWK8ZK++Vp0xfBRCx0eeT/HkijXNwBlMvmuOBn/
1dKulHXaZhOCQ1657nF/6LvQF3QpJ7y6I3Ste5+d+YJIVlxXPPmawnkD0sAj2ExgchnsKL/VoL/
2wvT9qSyaAvue9OAtY2jEN8V78RMR3Ftytg1SsAAACBAJlOJYWOXmKJzfple5dKq6NKJQzNcLgGKvvwZKwC2fe9gL6y
GY
+PoH6henBAApKWqUxtaTamZAjhmowZ2Mv0ST13jvaX9i8K0hjxfHP3l03OvCFcSLWxj3NeMnas7HSEgvRRwrohm51V
HEHlu+U8GWd36E6AjjUzlcfreym5IRDv [email protected]

Connecting without password

Connect just like before, there should be no request for your password:

w3r:~ psr$ ssh [email protected]


Join our Question Answer community to learn and share your programming knowledge.

Help the community:

PHP: Loop

JavaScript: Delete duplicates in an array

Oracle: Round the number