Linux User Management

Linux had a multi user structure, that’s mean you can use many users on Linux. If you want to add new user, you can use adduser or useradd command if you want to delete user, you can use deluser or userdel command.

A sample useradd command > useradd -m -g [group_name] -G [othergroups_name] -s [used_shell] [user_name]

NOTE: If you want to add user you will be root authority.

What is the mean ‘-m’: It’s create home directory for your add user.

What is the mean ‘-g’: It’s specify what is group included.

NOTE: If you want to look groups, cat /etc/group

What is the mean ‘-G’: Additional groups.

What is the mean ‘-s’: Shell way we will use.

NOTE: If you want to see your shell way echo $SHELL

If you want to see who am I ?

If you enter history command you can see all command history.

 

Let’s enter some commands and do practical.

Screenshot from 2018 10 21 09 41 36 300x169 - Linux User Management

User eredot add but it’s not have any password so we can’t login with eredot. So we can enter paswd command and enter strong password. Now we will login with eredot user. We will use su command. If you enter id command you can see UID(User ID) and other ID’s

Screenshot from 2018 10 21 09 53 42 300x169 - Linux User Management

USER PERMİSSİONS

User permissions are three types. These are Read(r),Write(w) and Execute(x). Each file have some permissions and you can change these permission with chmod command if we will use ‘+’ after chmod command that’s mean we will give some authority, if we will use ‘-‘ after chmod command that’s mean we will delete some authority. If you want to give permission all files in folder you can use ‘-R’ after chmod command.

These permissions express some numerical values.

Read(r) –> 4          Write(w) –> 2          Execute(x) –> 1           If you plus all values => 4+2+1 =7

If we will enter chmod +777 [file_name] we can give all authority to all persons.

We will use ls -ln or ls -l commands for see permissions. These permissions are in groups, look at this photo you will understand. If you enter any file name you can see this file’s permission.

NOTE: When you enter the ls -ln command, the users are represented by their “ID”, unlike the ls -l command.

download 1 1 300x157 - Linux User Management

Consider these photos.

Screenshot from 2018 10 21 10 39 39 300x169 - Linux User Management

images - Linux User Management