Adding user with root privileges
sudo useradd -m testuser
sudo passwd testuser
sudo usermod -s /bin/bash testuser
Restart ssh
/etc/init.d/ssh restart
Check your access can ssh but not able to have root access
Open the file sudoers
vim /etc/sudoers
Add the following lines below the root line in the file
testuser ALL=(ALL:ALL) ALL
write quite
Service ssh restart
/etc/init.d/ssh restart
Check again for root access. Got access.
Changing ssh port. Edit sshd_config file
vim /etc/ssh/sshd_confing
Port 22
change it to desired one
wq
service ssh restart
Check again with new port
ssh -p 220 testuser@SERVER_IP
Successfully logged in.
Restricting root user from direct login.
Edit sshd_config and add
PermitRootLogin no
and comment PermitRootLogin yes
service ssh restart
Now adding sftp users
create backup of sshd_config
Create new users with home directories
Create their passwords
Add it to group
No comments:
Post a Comment