You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# add user with prompt hints for setting up
adduser git
# add user silently without creating home directory
useradd git
# or specify a default login home directory
useradd git -d /home/git
# then change the password
passwd git
list all user -- cut -d: -f1 /etc/passwd
delete user -- userdel git or use userdel -r git to remove home directory
git:x:1000:1000::/home/git:/bin/bash config git user to use /bin/bash
/etc/group -- groups info file
use who to see who is online
add User to Group -- usermod -g github git
Sudoers -- vim /etc/sudoers
ssh into servers
change config - vim /etc/ssh/sshd_config
restart sshd - service sshd restart
generate public key and private key
# swith to the target user
su - git
# generate rsa key
ssh-keygen -t rsa
# `authorized_keys` is the public key# this command adds the generated public key to `sshd`'s default public key file `authorized_keys`
mv ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
chmod 400 ~/.ssh/authorized_keys
# take the private key out and remove the private key on the server
rm –rf ~/.ssh/id_rsa
# login using private key
ssh git@<your-host> -i <path-to-your-private-key>
ssh alias
visit man ssh_config for more info about ssh_config
edit ~/.ssh/config
Host git-alias
HostName git.com
User git
Host git-server
HostName git.com
you can use ssh git-alias or ssh git@git-server to login which is a great life saver! visit here for more.