configure new VPS

user

add new user

1
2
adduser ubuntu  # new user's direction automatically
useradd ubuntu # need to new dir manually

add user to admin group / edit sudoers

1
2
groupadd superadmin
usermod -g superadmin ubuntu
1
adduser ubuntu --ingroup sudo  # new user and assign to sudo group
1
vim /etc/sudoers

user state

1
id ubuntu

upload public key

method1

1
ssh-keygen

new file authorized_keys and paste your own public key into this file.

method2

1
ssh-copy-id -i .ssh/common.pub root@ip:port

automatically upload public key.

change login method

1
2
cd /etc/ssh
vim sshd_config
1
2
3
4
RSAAuthentication yes
PubkeyAuthentication yes
PermitRootLogin no
PasswordAuthentication no

restart ssh service

1
service ssh restart

log

1
cd /var/log

auth.log: authentication log