LinuxQuestions.org
Help answer threads with 0 replies.
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 01-01-2009, 02:50 PM   #1
aspedisca
LQ Newbie
 
Registered: Dec 2008
Posts: 20

Rep: Reputation: 0
logging in as root


Hi all,
I am new to linux an I have some questions. I have a small server(NSLU2) running debian at home. I installed lighttpd and mt-daapd and everything on the root account. Is that something wrong? I was going to install rtorrent but I read in somewhere saying not to install it from root account. Will you tell me if I have a security problem in my current system at home. Should I reinstall debian?

Thank you in advance
 
Old 01-01-2009, 02:57 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Quote:
Originally Posted by aspedisca View Post
Hi all,
I am new to linux an I have some questions. I have a small server(NSLU2) running debian at home. I installed lighttpd and mt-daapd and everything on the root account. Is that something wrong? I was going to install rtorrent but I read in somewhere saying not to install it from root account. Will you tell me if I have a security problem in my current system at home. Should I reinstall debian?

Thank you in advance
Hi aspedisca,

The only way to install things in Linux is as root (with a few exceptions, but don't mind it for now), so there is nothing wrong with it. What you should not do, however, is to run applications as root. E.g: you need to be root to install Firefox, but you should not surf the web with Firefox as root.

Since lighttpd and mt-daapd are services, you will need to start them as root as well (I think) so I don't see anything wrong with what you are doing: Installing programs, configuring the system and start/stopping services (eg: FTP server) are all administrator tasks (root). Surfing the web and listening to music, downloading stuff via FTP client are all examples of regular user task.

I hope this clarifies things a bit.

Regards!
 
Old 01-01-2009, 03:01 PM   #3
aspedisca
LQ Newbie
 
Registered: Dec 2008
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mega Man X View Post
Hi aspedisca,

The only way to install things in Linux is as root (with a few exceptions, but don't mind it for now), so there is nothing wrong with it. What you should not do, however, is to run applications as root. E.g: you need to be root to install Firefox, but you should not surf the web with Firefox as root.

Since lighttpd and mt-daapd are services, you will need to start them as root as well (I think) so I don't see anything wrong with what you are doing: Installing programs, configuring the system and start/stopping services (eg: FTP server) are all administrator tasks (root). Surfing the web and listening to music, downloading stuff via FTP client are all examples of regular user task.

I hope this clarifies things a bit.

Regards!
Hi Megaman,
Thank you for your fast reply. The question on my mind is I did not su from my account to install those. I just logged in as root and installed those. What is the difference between logging as a user then su and logging as a root? Thanks in advance
 
Old 01-01-2009, 03:12 PM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Quote:
Originally Posted by aspedisca View Post
Hi Megaman,
Thank you for your fast reply. The question on my mind is I did not su from my account to install those. I just logged in as root and installed those. What is the difference between logging as a user then su and logging as a root? Thanks in advance
You are welcome aspedisca . As far as I know, there is no difference between logging as an user and then using the su command or logging in as root from the beginning. su will simply switch your user to a root user.

I am not sure if you installed those programs when Gnome/KDE or anything else was running. Because starting X (eg: logging in to Gnome/KDE, etc) with a root user is also not recommended.

I always, always login as an ordinary user and use the su command if I really need to do administrator tasks. Logging as an ordinary user helps you to protect your computer against your yourself (seriously), perhaps even more against you than from any external attack. One wrong "rm" command as root and you can easily turn your system unusable.
 
Old 01-01-2009, 03:18 PM   #5
aspedisca
LQ Newbie
 
Registered: Dec 2008
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mega Man X View Post
You are welcome aspedisca . As far as I know, there is no difference between logging as an user and then using the su command or logging in as root from the beginning. su will simply switch your user to a root user.

I am not sure if you installed those programs when Gnome/KDE or anything else was running. Because starting X (eg: logging in to Gnome/KDE, etc) with a root user is also not recommended.

I always, always login as an ordinary user and use the su command if I really need to do administrator tasks. Logging as an ordinary user helps you to protect your computer against your yourself (seriously), perhaps even more against you than from any external attack. One wrong "rm" command as root and you can easily turn your system unusable.
I do not have gnome/kde or any desktop utility on my system (266 MHZ and 32 mb ram ). I just simply use terminal window to use. I feel relieved after your answers. I recently had an attack to my system because I opened port 22 from router without any precautions. In the end I installed the system allover again and decided to be more careful about everything. Anyway, thanks for your help.
Happy new year. Cheers...
 
Old 01-01-2009, 03:55 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,604
Blog Entries: 25

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Hi,
Quote:
Originally Posted by aspedisca View Post
Hi Megaman,
Thank you for your fast reply. The question on my mind is I did not su from my account to install those. I just logged in as root and installed those. What is the difference between logging as a user then su and logging as a root? Thanks in advance
The logging in as 'su' (superuser);

Code:
excerpt from 'man su';
NAME
       su - change user ID or become super-user

SYNOPSIS
       su [-] [username [args]]

DESCRIPTION
       su is used to become another user during a login session. Invoked with-
       out a username, su defaults to becoming the super  user.  The  optional
       argument  -  may be used to provide an environment similiar to what the
       user would expect had the user logged in directly.

...
When logging into the 'root' account then you have system wide services available on the account. With 'su' you are becoming the 'root/superuser' from your login account to get the same level of access. The system knows no difference if you provide the proper password for the account. You will exit the 'su' to your user login account. When you exit the 'root' you exit to the system login. Either way you should use good judgment when utilizing the superuser account.
 
Old 01-01-2009, 05:06 PM   #7
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
One small point that you may already know, and it is mentioned in the 'su' man page

Code:
The  optional argument  -  may be used to provide an environment similiar to what 
the user would expect had the user logged in directly.
If you 'su root', you will become root but your profile is not executed, so your PATH, HOME and other environmental variables may not be set correctly; if you 'su - root', you will become root AND root's profile will be executed.

just to avoid confusion in the future...

Last edited by tommylovell; 01-01-2009 at 05:07 PM.
 
Old 01-01-2009, 11:05 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,604
Blog Entries: 25

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Hi,
Quote:
Originally Posted by tommylovell View Post
One small point that you may already know, and it is mentioned in the 'su' man page

Code:
The  optional argument  -  may be used to provide an environment similiar to what 
the user would expect had the user logged in directly.
If you 'su root', you will become root but your profile is not executed, so your PATH, HOME and other environmental variables may not be set correctly; if you 'su - root', you will become root AND root's profile will be executed.

just to avoid confusion in the future...
Good point! I just cut the 'man su' so the OP would get the general idea.
 
  


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
logging into root jilloper Linux - Software 2 08-20-2007 09:34 AM
Logging on as Root tim1348 Linux - Newbie 6 12-27-2006 06:23 PM
logging in as root unklekoolaid Ubuntu 9 09-01-2006 12:10 PM
logging in as root computerdude Linux - Software 7 09-06-2005 04:38 PM
using red-carpet without logging out and logging as root. packman Linux - Software 1 12-09-2002 03:55 AM


All times are GMT -5. The time now is 05:48 PM.

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