User levels in linux

User Types (sudo, su, id, w, who and id commands)

There are three basic types of Linux user accounts: administrative (root), regular, and service.

The Linux administrative root account is automatically created when you install Linux, and it has administrative privileges for all services on Linux Operating System. The root account is also known as super user

Regular users have the necessary privileges to perform standard tasks on a Linux computer such as running word processors, databases, and Web browsers. They can store files in their own home directories. Since regular users do not normally have administrative privileges, they cannot accidentally delete critical operating system configuration files.

Services such as Apache, Squid, mail, games, and printing have their own individual service accounts. These accounts exist to allow each of these services to interact with your computer.

Each user on a Red Hat Enterprise Linux system is assigned a unique user identification number, also known as a UID. UIDs below 500 are reserved for system users such as the root user and service users.

A user group is a group of one or more users. A user can be a member of more than one group. In Red Hat Enterprise Linux, when a user is added, a private user group (primary group) is created—meaning that a user group of the same name is created and that the new user is the sole user in that group.

There are 3 types of user accounts in linux.They are:

1> System Users
2> Root User(Administrator)
3> Other Users(Normal User)

In linux, Uid from 1 to 500 has been reserved for system
users,these are the default users of linux,so if anyone try
to assign Uid 500 to normal user then it wil give the error.

Linux User Types

There are different types of accessibility options provided by Linux, from which one can choose respective access as per requirement. Linux provides 5 different alternatives to choose the accessibility.

  1. Super Useror Root User : A special kind of user account which holds all kind’s of permissions to do any alteration to a programs or services of Linux. Especially this kind of user account is used for system administration. He can control and limit the access of other User’s. As all the powers is vested for Root User, care has to be taken before performing each and every modifications, if anything goes wrong, no option left other than crash of Kernel. It is so sensitive with unlimited accessibility. 🙂 . Take care while logged in as Root 🙂
  2. System User: It is created by default by the OS. This type of user is similar to normal user but got more privileges and access to secure programs which normal user doesn’t got authentication.
  3. Normal User : These are the users which have been created by the Rootand has limited access to the resources and need permission from Root to access any secure resources and services.
  4. Network User : Users opt this type of user account to check network activity and to manage them. Especially system administrator‘s and network engineer‘s uses this account for various network activities and to connect to different systems on the network using various services like LDAP, NFS, SAMBA,APACHE, NTP etc. .
  5. Pseudo User: It’s a replica of Root User, is used when a user needs the permissions similar to Root User. Only Root User can give the access to thisuser account for others.
Читайте также:  Var file system in linux

Every Users got their own identity and authenticity. When i say Identity of the User,UID (User identifier) comes into picture. UID is a unique identity, simply a number given to the user.

Every kind of User type as discussed above are given a particular range of UID’s.

UID for Normal User lies with in the range of > 500

UID for Network User lies with in the range of >6000.

If you want to verify yourself or wanna see who you logged in as …

just simply do the following.

[root@localhost~]# whoami

Feed the above command to the terminal, that’s it. The output clears your ambiguity of as whom you are logged in. Ha ha.

ubuntu_root_user

Or else you can also try the below possibilities too . 🙂

[root@localhost~]#id

uid=0( root ) gid=0( root ) groups=0( root )

[root@localhost~]#

ubuntu_root_id

Hmm that’s cool. let’s give a try to below command too.

[root@localhost~]#id root

uid=0( root ) gid=0( root ) groups=0( root ), 1( bin ), 2 ( daemon ), 3 (sys ), 4 ( adm ), 6 ( disk ), 10 ( wheel )

[root@localhost~]#

rootuser_id

The above commands are only to show and give an idea about the UID of root user, Don’t try to analyse the other stuff of output, they simply confuse you. So as of now you are in no hurry to know about them, in latter stages you can understand them in deeper and succinctly.

If you want to switch from one user account to other user account, we use a command called ” su “.

Syntax: su username

[root@localhost~] # su charan

[charan@localhost~]$

We can find the type of user as logged in easily by observing above commands. Root User is accompanied by the symbol ‘ # ‘, where as normal user is accompanied with ‘ $‘. It’s simple rite.

How To Use ‘Sudo’ And ‘Su’ Commands In Linux : An Introduction

Today We’re going to discuss sudo and su, the very important and mostly used commands in Linux. It is very important for a Linux user to understand these two to increase security and prevent unexpected things that a user may have to go through. Firstly we will see what these commands do then we’ll know the difference between both of them. So let’s get started.

Note: This article is specific for Ubuntu users, although many things are also in other distributions.

Introduction to Linux command ‘sudo’

Introduction to Linux command ‘sudo’

In Ubuntu Linux there is not root account configured by default. If users want root account password then they can manually set it up oo can use ‘sudo’. As we all know, Linux in many ways protects users’ computer being used for bad purposes by some nasty people around us. Using sudo is one of those good ways. Whenever a user tries to install, remove and change any piece of software, the user has to have the root privileges to perform such tasks. sudo, linux command is used to give such permissions to any particular command that a user wants to execute. sudo requires the user to enter user password to give system based permissions. For example user wants to update the operating system by passing command –

Читайте также:  Самых красивых дистрибутивов linux

apt-get update error

This error is due to not having root privileges to the user ‘sandy’. The root privileges can be required by passing sudo at the very beginning, like below-

Linux command

As you can see when I used apt-get update that is a packaging management tool and through that I tried to update my system but it failed because to make this command work for me, I must have root privileges. So the next time I used the same command along with ‘sudo’ and this time sudo command asked user password to have root privileges to update system. After entering user password it system updated.But there may not be all the user accounts able to use sudo. As a system administrator, he has to give the rights whether any particular user can sudoer to do particulars admin tasks. To read that in description jump over here on the official page.

Some more examples of ‘sudo’ –

This command will install packages with the root privileges.

This command will remove packages with the root privileges.

This command will update packages with the root privileges.

Introduction to Linux command ‘su’

The Linux command ‘su’ is used to switch from one account to another. User will be prompted for the password of the user switching to.

Users can also use it to switch to root account. If user types only ‘su’ without any option then It will be considered as root and user will be prompted to enter root user password.

linux command su

As you can see su asked me root password and gave error ‘Authentication failure’ because I have not setup root password. I mentioned above in most distributions root password is not configured by default. Once the root password is setup then you can use it here to switch to root account very quickly.There is one more benefit of ‘su’ command that you can swith to any of the user account without user password. No need to remember different passwords for different user account; just user ‘su’.

How to switch to root user without configuring root password

Switching to root user without configuring root password seems to be confusing because above I said to switch to root user the normal user needs to configure root password manually. But stop! Here is a way to do that without configuring root password; just use ‘sudo’.We can use sudo and enter normal user password to switch to root user. Here see how we can do that with the power of sudo –

switch to root with sudo command

Using ‘su’ command to have functionality similar to ‘sudo’

If user only uses ‘su’ command and want to use ‘su’ as ‘sudo’ then it can be done. (here root password is assumed to have been configured because user is familiar with ‘su’.)To achieve same sudo functionality to execute any single command user has to use ‘-c’ option of ‘su’. Here is how to do it –

Читайте также:  Linux mint root права

After hitting enter user will be prompted for password and obviously it’s for root password because we’re using ‘su’ command.

Using ‘sudo’ command to have functionality similar to ‘su’

Above we have seen ‘su’ having similar functionality as sudo and it’s time to see how we can do same with the command ‘sudo’ and achieve same ‘su’ functionality.To achieve same ‘su’ functionality in ‘sudo’ just use ‘-i’ option of ‘sudo’. Here is how we can do it –

linux commands sudo functionality same as su

When user hits enter, it will ask password its the user password not the root password.It’s all done!

Источник

What are the concepts of «kernel ring buffer», «user level», «log level»?

I often saw the words «kernel ring buffer», «user level», «log level» and some other words appear together. e.g.

/var/log/dmesg Contains kernel ring buffer information. /var/log/kern.log Contains only the kernel’s messages of any loglevel /var/log/user.log Contains information about all user level logs

Are they all about logs? How are they related and different? By «level», I would imagine a hierarchy of multiple levels? Is «user level» related to «user space»? Are they related to runlevel or protection ring in some way?

2 Answers 2

Yes, all of this has to do with logging. No, none of it has to do with runlevel or «protection ring».

The kernel keeps its logs in a ring buffer. The main reason for this is so that the logs from the system startup get saved until the syslog daemon gets a chance to start up and collect them. Otherwise there would be no record of any logs prior to the startup of the syslog daemon. The contents of that ring buffer can be seen at any time using the dmesg command, and its contents are also saved to /var/log/dmesg just as the syslog daemon is starting up.

All logs that do not come from the kernel are sent as they are generated to the syslog daemon so they are not kept in any buffers. The kernel logs are also picked up by the syslog daemon as they are generated but they also continue to be saved (unnecessarily, arguably) to the ring buffer.

The log levels can be seen documented in the syslog(3) manpage and are as follows:

  • LOG_EMERG: system is unusable
  • LOG_ALERT: action must be taken immediately
  • LOG_CRIT: critical conditions
  • LOG_ERR: error conditions
  • LOG_WARNING: warning conditions
  • LOG_NOTICE: normal, but significant, condition
  • LOG_INFO: informational message
  • LOG_DEBUG: debug-level message

Each level is designed to be less «important» than the previous one. A log file that records logs at one level will also record logs at all of the more important levels too.

The difference between /var/log/kern.log and /var/log/mail.log (for example) is not to do with the level but with the facility, or category. The categories are also documented on the manpage.

Источник

Оцените статью
Adblock
detector