sh 在Amazon Linux上创建新的ssh用户

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 在Amazon Linux上创建新的ssh用户相关的知识,希望对你有一定的参考价值。


## On ther server

# Creating new user
sudo adduser newuser

# Setup password
sudo passwd newuser

# Add user to wheel group
sudo usermod -G wheel newuser

# Make sure the target user added to wheel group
grep wheel /etc/group

# Add sudo permisison to the target user
sudo visudo
# newuser ALL=(ALL) NOPASSWD: ALL


## On the local

# Move into .ssh dir
cd ~/.ssh

# Setup the key pair
ssh-keygen -t rsa -f id_rsa_newuser

# copy the pub key
cat id_rsa_newuser.pub | pbcopy


## On the server
cd /home/newuser

## Create the .ssh dir
mkdir .ssh

# paste the pub key
vi .ssh/authorized_keys

# Setup the group
chown -R newuser:newuser ./.ssh

# Permission settings
chmod 700 .ssh && chmod 600 .ssh/authorized_keys

## ALl done! Try to test the login as newuser

以上是关于sh 在Amazon Linux上创建新的ssh用户的主要内容,如果未能解决你的问题,请参考以下文章