How to configure ssh server in RHEL,Centos,Fedora?
Step 1:- First Install openssh client and server In RHEL,Centos,Fedora via yum .Run below command in terminal .
yum -y install openssh-server openssh-clients
Step 2:- Now verify openssh rpm installed successfully or not .Run below command in terminal .
rpm -qa openssh*
Step3:- Now go to /etc/ssh directory and edit sshd_config.
vi /etc/ssh/sshd_config
By Default root login enable in ssh.
PermitRootLogin yes
Change it like below
PermitRootLogin no
AllowUsers rahul pooja
Uncommet port 22 like below
port 22
save and exit Press Esc key and type below command
:wq!
Step4:- Create two users rahul and pooja.
useradd rahul
useradd pooja
Set password of rahul and pooja.
Run below command
passwd rahul
enter password of rahul then Press enter and again type same password and press enter
same as follow for pooja user.
passwd pooja
service sshd restart
configure ssh service to start automatically during the system startup on runlevel 3 and 5 .Run below command in terminal.
chkconfig --level 35 sshd on
Step 6:- Open 22 port for ssh server via iptables.Run below command in terminal.
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
To save rule in iptables permanently.Run below command in terminal.
service iptables save
Step 7:- Login via users rahul and pooja.Run below command in terminal.
ssh rahul@ip of your ssh server
ssh -l pooja ip of your ssh server.
Step 1:- First Install openssh client and server In RHEL,Centos,Fedora via yum .Run below command in terminal .
yum -y install openssh-server openssh-clients
Step 2:- Now verify openssh rpm installed successfully or not .Run below command in terminal .
rpm -qa openssh*
Step3:- Now go to /etc/ssh directory and edit sshd_config.
vi /etc/ssh/sshd_config
By Default root login enable in ssh.
PermitRootLogin yes
Change it like below
PermitRootLogin no
AllowUsers rahul pooja
Uncommet port 22 like below
port 22
save and exit Press Esc key and type below command
:wq!
Step4:- Create two users rahul and pooja.
useradd rahul
useradd pooja
Set password of rahul and pooja.
Run below command
passwd rahul
enter password of rahul then Press enter and again type same password and press enter
same as follow for pooja user.
passwd pooja
Step5:- now restart ssh service .Run below command in terminal.
service sshd restart
configure ssh service to start automatically during the system startup on runlevel 3 and 5 .Run below command in terminal.
chkconfig --level 35 sshd on
Step 6:- Open 22 port for ssh server via iptables.Run below command in terminal.
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
To save rule in iptables permanently.Run below command in terminal.
service iptables save
Step 7:- Login via users rahul and pooja.Run below command in terminal.
ssh rahul@ip of your ssh server
ssh -l pooja ip of your ssh server.
