When I’m setting up a linux system, since it’s not very often, I have to keep looking up the basic commands for user setup.
I had started putting them in a text file and now it’s reached here!
All following commands to be run as root
if no network
Edit /etc/network/interfaces
and add the following:
auto eth0 allow-hotplug eth0 iface eth0 inet dhcp
install sudo
apt-get install -y sudo
change default visudo editor
update-alternatives --config editor
Full details here
enable wheel
group
This is a handy group for when you want the user to access root without a password.
- Via
visudo
, enable the following
%wheel ALL=(ALL) ALL
2. Edit /etc/pam.d/su
. Uncomment the following line
auth sufficient pam_wheel.so trust
new user
Reference: AskUbuntu
create user with prompts
adduser <username>
create user with explicit settings
useradd <username>
create a new user without a group
useradd <username> --gid nogroup
create a new user without a shell
useradd <username> --shell /bin/false
Create new user with auto-create home directory
useradd -d /home/<username> -m <username>
Delete a user
deluser <username>
Delete a user with auto-delete home directory (and mail spool)
deluser --remove-home <username>
new group
Add a new Group
groupadd <groupname>
e.g.
groupadd wheel
Add existing user to existing group
usermod -a -G <groupname> <username>
Remove existing user from group
deluser <username> <groupname>
to check groups which a user belongs to
groups <username>