Install OpenSSH in Ubuntu Server 11.04
Also setup SSH client software to login in server via ssh with PuTTy.
I use folowing steps for installing OpenSSH
Also setup SSH client software to login in server via ssh with PuTTy.
I use folowing steps for installing OpenSSH
Install OpenSSH in Ubuntu Server 11.04
Also setup SSH client software to login in server via ssh with PuTTy.
Also setup SSH client software to login in server via ssh with PuTTy.
I use folowing steps for installing OpenSSH
1) Installation of OpenSSH Server
2) OpenSSH configuration (Password auth)
3) OpenSSH configuration (Key auth)
1) Installation of OpenSSH Server
Check OpenSSH is installed or not.
$ dpkg -L openssh-server
If not installed the install with following command.
$ sudo aptitude -y install openssh-server
OR
$ sudo apt-get install openssh-server
2) OpenSSH configuration (Password auth)
Backup your config file first
$ sudo cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_yyyymmdd
Edit your config file.
$ sudo vim /etc/ssh/sshd_config [if vim not work the use vi]
PermitRootLogin no <= user root not permit.
Restart service.
$ sudo /etc/init.d/ssh restart
Now you can login with PuTTY. Also you can use other ssh client. etc TeraTerm.
3) OpenSSH configuration (Key auth)
Generate auth key
RSA#Í######################B
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hoge/.ssh/id_rsa): Blank Enter
Created directory '/home/hoge/.ssh'.
Enter passphrase (empty for no passphrase): ******** (Add your password phrase)
Enter same passphrase again: ******** (Confirm your password phrase)
Your identification has been saved in /home/hoge/.ssh/id_rsa.
Your public key has been saved in /home/hoge/.ssh/id_rsa.pub.
The key fingerprint is:
--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:-- username@hostname
The key's randomart image is:
+--[ RSA 2048]----+
| ( keys ) |
+-----------------+
This key generatation create two files (id_rsa) and (id_rsa.pub) in ~/.ssh/
Publish key configuration
Rename the publish key
$ mv ~/.ssh/id_rsa.pub authorized_keys
If you dont want to rename then you can create new file with command below
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Change Read/Write permission for youself
$ chmod 600 ~/.ssh/authorized_keys
Register key which generate in the other terminal
Copy the key in the server using WinSCP or SCP command.
Create .ssh directory
$ mkdir ~/.ssh
Move the key in the directory ~/.ssh/
$ mv ~/id_rsa.pub ~/.ssh/authorized_keys
Change Read/Write permission for youself
$ chmod 600 ~/.ssh/authorized_key
Setup key in Windows. (For this you need to "puttygen.exe" so download before you start this.)
Copy the file "id_rsa" from server using WinSCP.
Run "puttygen.exe"
Open [Menu]-[Convertor]-[Import Key]
Select private key which you copy from ther server using WinSCP.
[Enter Passphrase] ********
Click [Save privater key]
You can save the private key wih any name and anywahere in your PC.
Windows putty login with key
Enter hostname:
[Connection]-[SSH]-[Auth] and [authentication Parameters]-[Private key file for Authentication]
and click [Browse] buuton. Select the key which you save with "puttygen.exe".
Press open and enter your user name and password.
Now you can login in the server done.
Now you dont need the "PasswordAuthentication" so disable this.
Edit config file
$ sudo vi /etc/ssh/sshd_config
PasswordAuthentication no <= PasswordAuthentication not permit
PermitEmptyPasswords no <= EmptyPassword not permit
Restart service
$ sudo /etc/init.d/ssh restart
Now you dont need "id_rsa" file in the server so lets delete for security.
$ rm ~/.ssh/id_rsa
1) Installation of OpenSSH Server
2) OpenSSH configuration (Password auth)
3) OpenSSH configuration (Key auth)
1) Installation of OpenSSH Server
Check OpenSSH is installed or not.
$ dpkg -L openssh-server
If not installed the install with following command.
$ sudo aptitude -y install openssh-server
OR
$ sudo apt-get install openssh-server
2) OpenSSH configuration (Password auth)
Backup your config file first
$ sudo cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_yyyymmdd
Edit your config file.
$ sudo vim /etc/ssh/sshd_config [if vim not work the use vi]
PermitRootLogin no <= user root not permit.
Restart service.
$ sudo /etc/init.d/ssh restart
Now you can login with PuTTY. Also you can use other ssh client. etc TeraTerm.
3) OpenSSH configuration (Key auth)
Generate auth key
RSA#Í######################B
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hoge/.ssh/id_rsa): Blank Enter
Created directory '/home/hoge/.ssh'.
Enter passphrase (empty for no passphrase): ******** (Add your password phrase)
Enter same passphrase again: ******** (Confirm your password phrase)
Your identification has been saved in /home/hoge/.ssh/id_rsa.
Your public key has been saved in /home/hoge/.ssh/id_rsa.pub.
The key fingerprint is:
--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:-- username@hostname
The key's randomart image is:
+--[ RSA 2048]----+
| ( keys ) |
+-----------------+
This key generatation create two files (id_rsa) and (id_rsa.pub) in ~/.ssh/
Publish key configuration
Rename the publish key
$ mv ~/.ssh/id_rsa.pub authorized_keys
If you dont want to rename then you can create new file with command below
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Change Read/Write permission for youself
$ chmod 600 ~/.ssh/authorized_keys
Register key which generate in the other terminal
Copy the key in the server using WinSCP or SCP command.
Create .ssh directory
$ mkdir ~/.ssh
Move the key in the directory ~/.ssh/
$ mv ~/id_rsa.pub ~/.ssh/authorized_keys
Change Read/Write permission for youself
$ chmod 600 ~/.ssh/authorized_key
Setup key in Windows. (For this you need to "puttygen.exe" so download before you start this.)
Copy the file "id_rsa" from server using WinSCP.
Run "puttygen.exe"
Open [Menu]-[Convertor]-[Import Key]
Select private key which you copy from ther server using WinSCP.
[Enter Passphrase] ********
Click [Save privater key]
You can save the private key wih any name and anywahere in your PC.
Windows putty login with key
Enter hostname:
[Connection]-[SSH]-[Auth] and [authentication Parameters]-[Private key file for Authentication]
and click [Browse] buuton. Select the key which you save with "puttygen.exe".
Press open and enter your user name and password.
Now you can login in the server done.
Now you dont need the "PasswordAuthentication" so disable this.
Edit config file
$ sudo vi /etc/ssh/sshd_config
PasswordAuthentication no <= PasswordAuthentication not permit
PermitEmptyPasswords no <= EmptyPassword not permit
Restart service
$ sudo /etc/init.d/ssh restart
Now you dont need "id_rsa" file in the server so lets delete for security.
$ rm ~/.ssh/id_rsa
No comments:
Post a Comment