• Home
  • Health
  • Software
  • Blog
  • ssh

    Create New User

    adduser ubuntu
    usermod -aG sudo ubuntu
    cd /home/ubuntu/
    mkdir .ssh
    chmod 700 .ssh
    chown ubuntu:ubuntu .ssh
    cp -a /root/.ssh/authorized_keys . #or make a new key
    chmod 600 authorized_keys
    chown ubuntu:ubuntu authorized_keys
    
    # Can update password:
    passwd ubuntu
    # Can delete password:
    passwd -d ubuntu
    
    # backup /etc/ssh/sshd_config now
    # if it doesn't work, set these properties in /etc/ssh/sshd_config:
    # commented out options show the defaults, e.g. #UsePAM yes
    UsePAM no
    AuthorizedKeysFile      %h/.ssh/authorized_keys
    PubkeyAuthentication yes
    PasswordAuthentication no
    ChallengeResponseAuthentication no
    
    service ssh restart
    
    # Make sure the correct shell is set for the user here:
    nano /etc/passwd