sudo
opinionssudo EDITOR=vim visudo
Then:
Defaults requiretty
line to avoid “you must have a tty to run sudo” errorssudo
without password:
-%sudo ALL=(ALL:ALL) ALL
+%sudo ALL=(ALL:ALL) NOPASSWD: ALL
systemd
:)
Add Defaults env_keep += "SYSTEMD_PAGER"
to /etc/sudoers
echo 'export SYSTEMD_PAGER=' | sudo tee /etc/profile.d/systemd_pager.sh
On the remote machine:
adduser
is an interactive perl script that asks for each detail of information incrementallyuseradd
is the basic linux system command (non-interactive)
-m
creates a home directory in some default location (see /etc/default/useradd
for those defaults)-U
create a group of the same name as the user-G group1,group2
csv of secondary groupssudo useradd -m -U -G wheel chbrown
And then maybe set the password:
sudo passwd chbrown
Return to the local machine. Copy default local public key to the remote machine:
ssh-copy-id chbrown@remote
Or if you don’t have ssh-copy-id
:
mkdir -pm 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub | ssh remote 'cat >> ~/.ssh/authorized_keys'