LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2013, 11:32 AM   #1
mike89
LQ Newbie
 
Registered: Oct 2013
Posts: 3

Rep: Reputation: Disabled
Login as root in Linux system


I wanted to know when is it necessary to log in as root in a Linux system, can anyone explain to me because I'm a newbie in Linux. I don't really understand about Linux because this is my first time using Linux in my VMware.
 
Old 10-16-2013, 11:39 AM   #2
TroN-0074
Senior Member
 
Registered: Dec 2011
Location: Michigan USA
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
Is this a homework question?
Anyway I think you will need to log in as root whenever you need to make changes to your system. I mean changes on the file system, users groups, installing or removing applications. for a regular session you can just log in as user and enjoy browsing away or watching videos or whatever.

good luck to you.
 
1 members found this post helpful.
Old 10-16-2013, 12:00 PM   #3
mike89
LQ Newbie
 
Registered: Oct 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
no, I really wanna know coz I just install Linux in Vmware and I register to main user in root but it say that I should make another user and sign in to root user not the home user....thats y I'm confuse.
 
Old 10-16-2013, 12:02 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,133
Blog Entries: 2

Rep: Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836
The root user is only used for system maintenace, like installing programs, updating the system or changing system-wide configurations. For normal use you should always use an unprivileged user.
 
Old 10-16-2013, 12:03 PM   #5
TroN-0074
Senior Member
 
Registered: Dec 2011
Location: Michigan USA
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
Yeah you should create a user and log in as user for most of your session, just because it is really easy to mess up your system if you are logged in as root all the time.

What Linux distro are you using and what version?
 
1 members found this post helpful.
Old 10-16-2013, 12:57 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,454

Rep: Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052
Simple answer:
root is used to change files/dirs (or run programs that can change files/dirs) that affect more than just yourself. A regular user can do anything they want to their own files/settings, but as soon as they try to do something that would affect other users on the system, they're blocked. root is the only one that can get past this restriction and make global changes to the system (ignoring complicated group setups and custom permissions, etc).


More accurate answer:
Regular users must abide by the permissions of any files/dirs on the system. Each file has an owner and a group, and read/write/execute permission flags for the owner, other members of its group, and "everyone else". A regular user will only be able to read that file if they are the owner and the read flag is set for the owner, or if they're a member of the same group as the file and the read flag is set for the group, or if the read flag is set for "everyone else". Same goes for write and execute. If the flag isn't set, the user can't do anything about it (the only exception is that if the file is owned by the user, the user/owner can modify the permissions as they wish).

Root does not have to abide by the permissions of the files/dirs. Root can do anything it wants, it can read files belonging to somebody else, it can delete global system files that don't have write permission, etc. On the computer, root is god.

So to answer your question, root is used whenever your regular user doesn't have the permission to do what needs to be done. Whether that's changing a system config file, restarting a service, reformatting a hard drive, adding/deleting user accounts, etc.

Last edited by suicidaleggroll; 10-16-2013 at 01:05 PM.
 
1 members found this post helpful.
Old 10-16-2013, 01:08 PM   #7
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,512
Blog Entries: 2

Rep: Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038
Then as a normal user you use su, sudo or GUI to run as root.

Last edited by jamison20000e; 10-29-2013 at 08:39 AM.
 
1 members found this post helpful.
Old 10-16-2013, 04:29 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,357

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Most distros are tying to get users to stop logging in as root. All OS's should have been doing that from the start.

It may be still best to use a user with the least amount of privileges at all times. When some action that requires higher privileges then one can sudo to root or even su to a user that has the required access.

You'd su or sudo from a terminal or some gui's that have been made to run from some admin user and requires a root password.

From a best practice point of view, you reduce exposure as much as you can. Exposing your system to a level with unlimited rights could present a security issue. Behind scenes programs could take advantage in this instance.

Still I get lazy and run su. Some distro's may have broken apps and I may need to actually log on to a root user once in a great while.
 
2 members found this post helpful.
Old 10-17-2013, 08:07 AM   #9
khamsamay
LQ Newbie
 
Registered: Oct 2013
Posts: 4

Rep: Reputation: Disabled
I understand that you may user for windows before.
it is easy to think that when you log in as administrator on windows, windows not warn you
so you can easily install-delete all software or change the system files.
but when you are newbie on linux , Linux will warn you that when you log in as root user
you may change the system file without intention.
 
1 members found this post helpful.
Old 10-17-2013, 08:13 AM   #10
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,512
Blog Entries: 2

Rep: Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038
not doing so probably eliminates lots of catastrophic failures and their need for help
 
1 members found this post helpful.
Old 10-17-2013, 10:47 AM   #11
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,437

Rep: Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360
Running as root also has the security risk that any malware can wind up anywhere on the system, because it's all accessible. You're not likely to get malware on Linux, but if ever you did, it's nice to know that it can't escape from /home!
 
2 members found this post helpful.
Old 10-17-2013, 12:47 PM   #12
ironhand41
LQ Newbie
 
Registered: Mar 2013
Posts: 6

Rep: Reputation: Disabled
From another newbie

I'm about a year into a dual-boot system (Win7 & Zorin 6.0) with the intention of leaving Winders behind forever now that I'm retired. I'm still getting my feet wet with Linux but in my experience you WILL need to do a few things as root. After wasting too much of my time when Linux would prevent me from opening particular files and folders (NOT system files, just files and folders I use in the normal course of a computing session) I taped a piece of paper to the bezel of my PC monitor that reads "root = gksudo nautilus." Typing that at the command line (or "bash" or whatever it is called in Linux) I can now quickly change the permissions of files and folders. So, I don't need a separate log-in account for root. The experts will caution you against running as root all or even most of the time and that is good advice. But I would rate the numerous occasions when Linux prevented me from opening files and folders because of the permissions issue, as one of the top three frustrations I've had with this new operating system. But I love it and enjoy the learning experience!

Cheers,

ironhand41

Zorin-OS 6 64bit/Win7x64 dual boot
SYX Venture A 1851 All-in-one PC; Model: SYX-GB-AEBN-SI: Genuine Intel® CPU i3-2120 @ 3.30 GHzx4:Ram 8 GiB DDR3.
SSD: Samsung 830; 512 GB
LCD 18.5": Resolution 1366x768.
802.11b/g/n Wireless.
Wired Verizon Fios Connection: 1000 Mb/s.
 
Old 10-17-2013, 12:59 PM   #13
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,512
Blog Entries: 2

Rep: Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038
Code:
man chown
man chmod

Last edited by jamison20000e; 10-17-2013 at 01:02 PM.
 
Old 10-19-2013, 02:03 PM   #14
mike89
LQ Newbie
 
Registered: Oct 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Something wrong again....maybe this is stupid question but how to solve problems created by a superuser
 
Old 10-19-2013, 02:10 PM   #15
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,454

Rep: Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052
Quote:
Originally Posted by mike89 View Post
Something wrong again....maybe this is stupid question but how to solve problems created by a superuser
Depends on what was done. Somebody who doesn't know what they're doing as root could easily destroy a system to the point of needing to wipe it and reinstall from scratch.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Login as root on the Ubuntu System LXer Syndicated Linux News 0 05-13-2011 08:00 PM
root login through system call(s) hifun Linux - Kernel 3 06-19-2009 07:49 PM
Cannot login to CentOS system even as root...disk failure? sneakyimp Linux - Newbie 10 04-11-2008 11:34 PM
safe guarding your system by not allowing anyone to login as root abhis_mail2002 Fedora 6 05-14-2006 02:58 AM
Unable to login as root - system freezes rcs1000 Linux - Security 4 07-26-2005 05:17 PM


All times are GMT -5. The time now is 01:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration