Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/f/8/sveitech.dk/httpd.www/wp-content/plugins/css-javascript-toolbox/framework/events/subjects/hook.subject.php on line 81 Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/f/8/sveitech.dk/httpd.www/wp-content/plugins/css-javascript-toolbox/framework/events/subjects/hook.subject.php on line 82 Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/f/8/sveitech.dk/httpd.www/wp-content/plugins/css-javascript-toolbox/framework/events/subjects/hook.subject.php on line 81 Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/f/8/sveitech.dk/httpd.www/wp-content/plugins/css-javascript-toolbox/framework/events/subjects/hook.subject.php on line 82 Managing Users | Sveitech

Managing Users

whoami

whoami

>john

Shows your current username.


who

who

>root pts/0 2014-10-10 23:07 (10.104.33.101)
>paul pts/1 2014-10-10 23:30 (10.104.33.101)
>laura pts/2 2014-10-10 23:34 (10.104.33.96)
>tania pts/3 2014-10-10 23:39 (10.104.33.91)

Shows information on who is logged into the system.


w

w

>23:34:07 up 31 min, 2 users, load average: 0.00, 0.01, 0.02
>USER TTY   LOGIN@ IDLE   JCPU  PCPU  WHAT
>root pts/0 23:07  15.00s 0.01s 0.01s top
>paul pts/1 23:30  7.00s  0.00s 0.00s w

Shows who is logged in and who is doing what.


id

id

>uid=1000(paul) gid=1000(paul) groups=1000(paul)

Shows your user id and which groups you belong to.


su

# Switch to user john
su john

# Append '-' to get an environment similar to if the user logged in directly.
# This means starting the the user home dir.
su john -

# Switch to root user
sudo su -

sudo

Execution attempts as sudo is logged in /var/log/auth.log on debian systems.


User Accounts

Groups

A user belongs to a primary group, which by default has the same name as the username. For example, a user ‘john’ will be part of the group ‘john’, when created. Whenever the user ‘john’ creates files, the file is set to belong to the user and group ‘john’.

Additionally, a user can belong to a number of secondary groups. This list determines which files the user is allowed to open or manipulate, if he is part of the correct group. Group information can be viewed for the current user with the ‘id’ command.

#Change current primary group for current login session
newgrp

#Change user account settings. Add users to groups, e.t.c.
usermod

#Create groups
groupadd

/etc/group

This file contains the local group database on most linux distributions.

man 5 group

/etc/passwd

This file contains the local user database on most linux distributions.

man 5 passwd

useradd (high-level version: adduser)

Add users to the system.


/etc/default/useradd

Default settings for new users created with useradd.


userdel

Remove existing user.


usermod

Change settings for an existing user, souch as password or groups.

Sveistrup Technologies