Default users 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.
Читайте также:  Which linux web server

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 –

Читайте также:  Tauon music box 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 –

Читайте также:  Argument to linux script

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 –

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!

Источник

Change default login user for Linux from root

I’ve been working with Linux for awhile and was wondering how I could go about changing the default login user. The whole time I’ve used Ubuntu, I’ve been logging in as the root node, as bad as that is. It does it automatically upon startup. Running Ubuntu in Windows Terminal with WSL. I’d appreciate any help. Thank you!

That did the trick. Had to create/source .profile into my home user directory, because I lost my colors, but all is well now. Thank you!

2 Answers 2

Went to the above link, and just went into cmd.exe and did: ubuntu2004 config —default-user

This caused a secondary issue where I lost my colors on the terminal, but that was resolved with:

  1. sudo nano /etc/passwd
  2. Scroll down to your user and change the numbers for user id and group both to 0. Example:

Be aware as this may result to unstable OS in some distros, or it may cause that some apps stop working.

No, no, no! This changes your user account to be effectively the same as root, which removes just about all protections the system can otherwise give you from shooting yourself in both feet

You must log in to answer this question.

Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.13.43531

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

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