Add a user: Difference between revisions

From Bitpost wiki
(Created page with "'''Ubuntu''' * sudo adduser m # this will prompt you for everything * sudo useradd -d /home/m -s /bin/bash -m m # this one-liner works well too * sudo visudo # add a NOPASSWD...")
 
No edit summary
 
Line 3: Line 3:
* sudo useradd -d /home/m -s /bin/bash -m m # this one-liner works well too
* sudo useradd -d /home/m -s /bin/bash -m m # this one-liner works well too
* sudo visudo # add a NOPASSWD entry for the user to the END of the file (or NOPASSWD won't stick)
* sudo visudo # add a NOPASSWD entry for the user to the END of the file (or NOPASSWD won't stick)
* cd .ssh # and scp two files from bitpost (make sure they're rw only to user): id_rsa and authorized_keys  
* cd .ssh # and scp two files from bitpost (make sure they're rw only to user): id_rsa and authorized_keys (might as well get id_rsa.pub, too)
* ensure permissions are right:
cd
chmod 700 .ssh
chmod 400 .ssh/id_rsa
'''Gentoo server'''
'''Gentoo server'''
  su -
  su -

Latest revision as of 14:04, 27 February 2018

Ubuntu

  • sudo adduser m # this will prompt you for everything
  • sudo useradd -d /home/m -s /bin/bash -m m # this one-liner works well too
  • sudo visudo # add a NOPASSWD entry for the user to the END of the file (or NOPASSWD won't stick)
  • cd .ssh # and scp two files from bitpost (make sure they're rw only to user): id_rsa and authorized_keys (might as well get id_rsa.pub, too)
  • ensure permissions are right:
cd
chmod 700 .ssh
chmod 400 .ssh/id_rsa

Gentoo server

su -
useradd #newuser# -m -G wheel(,etc)

# Other possibilities (likely not needed): 
## only needed if you want them to have their own group (otherwise use "users" group)
#groupadd #newuser#
## the additional groups here are optional
#useradd #newuser# -m -g #newuser# -G users,wheel,audio,video,games,dvd,usb -s /bin/bash
## Only needed if you didn't use [-m] option
#mkdir /home/#newuser#
#chown #newuser#:users /home/#newuser#

passwd #newuser#

# grant ssh access by adding to "AllowUsers"
em /etc/ssh/sshd_config
/etc/init.d/sshd restart

# grant samba access to home folder
# it's already set up in /etc/samba/smb.conf
# but the user must be manually added to samba
# use same pwd as before to sync them
smbpasswd -a #newuser#
/etc/init.d/samba restart

# YOU PROBABLY HAVE TO RESTART ANY STUPID WINDOWS BOX before it will see things correctly!  crazy
# you can try this in Windows but it didn't work for me:  
#  net use
#  net session \\samba.server.ip.address /delete