Running as root ( was Re: Change Permissions (snip)..Problem Solved )

Peter Garrett peter.garrett at optusnet.com.au
Tue Jan 9 23:44:32 UTC 2007


On Tue, 09 Jan 2007 14:05:20 -0600
mtyoung <tuxman at knology.net> wrote:

Yes, I do realize the danger of being a root user. That's why I said 
"logging in as root when needed".
Note that I immediately logged back in as a normal user after solving 
the problem.
I found it easy to tell that I was in root, since the desktop was 
completely different.

OK - but most people would avoid doing that. It gives a window of
opportunity to attackers ( although a short one, and of course your
machine should be protected in other ways, like firewalling and access
controls to services etc. ) More simply, it is incredibly easy to make a
mistake dragging and dropping stuff around, for example - say you
accidentally moved your /etc/ directory to your /home directory....
don't laugh, stranger things have happened ;)

Of course you can make similar mistakes on the command line, but it is
less likely - running sudo or sudo -i should remind you that now is a time
to be careful. Personally, I change the colour of the prompt for root so
that when I run "sudo -i" if I need to have a root shell for a series of
commands, it is suddenly a lurid green :) You can do this by uncommenting
the following section in  /root/.bashrc :   ( /root is root's "home"
directory )

# Comment in the above and uncomment this below for a color prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:
\[\033[01;34m\]\w\[\033[00m\]\$ '

"The above" refers to the block that begins
# set a fancy prompt (non-color, unless we know we "want" color)

and ends with

esac

Of course, a # will comment any line, to disable it.

> In the particular problem above, can you suggest a better way that I 
> could have solved the problem? I'm sure I'd learn something from it.

James has, as usual, posted an excellent solution, which you have of
course seen and responded to :)

With regard to the permissions "letters"  -  u=user g=group o=others and +
adds a permission, - removes a permission.  r=read , w=write , x=execute,
or for folders/directories, x=access

But James has pointed you to a good URl in his usual thorough manner :-)

Peter




More information about the ubuntu-users mailing list