LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 07-22-2011, 03:43 PM   #46
stormreactor
LQ Newbie
 
Registered: Jul 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled

Okay, new update.

After changing the name of UID 0 (root), sudo doesn't actually work correctly. If you use it to access a protected file, it will still deny permission (such as accessing /etc/sudoers, for example). Other operations, such as the GUI mount for DSL, will also not work.

What I mean to say is that this may not have been as 'clean' as I thought. While sudo gives the appearance of working, it does not. (You can still do root-level operations by switching to the root user with "su <root user>", however.)

Also, as I mentioned in an earlier reply, the network stops working in DSL. Some of these problems may just be DSL specific, but for your advice for anyone who wants do what I did, build your own Linux system and do it at the beginning. It will remove a lot of headache.

Nevertheless, if you do do it on a functioning system temporarily, it won't drastically kill it (with the stripped-down distros at any rate). You'll just have some problems with some system services and processes, that's all. Anyway, I hope this helps anyone who wants to replace 'root' out there, however few there may be. Good luck!
 
Old 07-22-2011, 03:52 PM   #47
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
yeah root has been a standard for the sysadmin's user name for decades, not just for linux/unix but other things like mysql
honestly i don't see any real reason to change it, but good luck
 
Old 07-22-2011, 04:42 PM   #48
tommylovell
Member
 
Registered: Nov 2005
Distribution: Raspbian, Debian, Ubuntu
Posts: 380

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by MTK358 View Post
I thought that the kernel doesn't pay attention to the user's name, and that it only uses the user IDs (0 == root).

I wonder what would happen if you would just rename the "root" entries in /etc/passwd and /etc/shadow to some other name.
As others have said, that's true. The name "root" has no real significance (or it least it should have no significance). UID=0 is what is important. (I'm not certain how this would all tie into SELinux, though.)

But, if you had this,
Code:
[root@athlon ~]# vi /etc/passwd

[root@athlon ~]# head -n3 /etc/passwd
root:x:0:0:root:/root:/bin/bash
notroot:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin

[root@athlon ~]# ls -n
total 104
-rw-------. 1 0 0  2177 Jul 17 02:38 anaconda-ks.cfg
-rw-r--r--. 1 0 0 62986 Jul 17 02:38 install.log
-rw-r--r--. 1 0 0 11682 Jul 17 02:33 install.log.syslog
-rwxr-xr-x. 1 0 0 13008 Jul 19 22:41 ps_mem.py
-rwxr-xr-x. 1 0 0   142 Jul 19 15:23 swap

[root@athlon ~]# ls -l
total 104
-rw-------. 1 root root  2177 Jul 17 02:38 anaconda-ks.cfg
-rw-r--r--. 1 root root 62986 Jul 17 02:38 install.log
-rw-r--r--. 1 root root 11682 Jul 17 02:33 install.log.syslog
-rwxr-xr-x. 1 root root 13008 Jul 19 22:41 ps_mem.py
-rwxr-xr-x. 1 root root   142 Jul 19 15:23 swap
Then reversed the first two /etc/passwd entries,
Code:
[root@athlon ~]# vi /etc/passwd

[root@athlon ~]# head -n3 /etc/passwd
notroot:x:0:0:root:/root:/bin/bash
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin

[root@athlon ~]# ls -n
total 104
-rw-------. 1 0 0  2177 Jul 17 02:38 anaconda-ks.cfg
-rw-r--r--. 1 0 0 62986 Jul 17 02:38 install.log
-rw-r--r--. 1 0 0 11682 Jul 17 02:33 install.log.syslog
-rwxr-xr-x. 1 0 0 13008 Jul 19 22:41 ps_mem.py
-rwxr-xr-x. 1 0 0   142 Jul 19 15:23 swap

[root@athlon ~]# ls -l
total 104
-rw-------. 1 notroot root  2177 Jul 17 02:38 anaconda-ks.cfg
-rw-r--r--. 1 notroot root 62986 Jul 17 02:38 install.log
-rw-r--r--. 1 notroot root 11682 Jul 17 02:33 install.log.syslog
-rwxr-xr-x. 1 notroot root 13008 Jul 19 22:41 ps_mem.py
-rwxr-xr-x. 1 notroot root   142 Jul 19 15:23 swap
If you logon as root after the above change is made,
Code:
Last login: Fri Jul 22 17:22:53 2011 from 192.168.1.99

[notroot@athlon ~]# whoami
notroot

[notroot@athlon ~]# w
 17:28:19 up 5 days,  8:52,  4 users,  load average: 0.16, 0.12, 0.13
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
tommy    tty7     :0               Sun08    5days 39.56s  0.25s pam: gdm-passwo
tommy    pts/0    :0.0             Sun08    5days  0.64s  1.78s gnome-terminal
root     pts/1    192.168.1.99     17:22    1:51   0.10s  0.10s -bash
root     pts/2    192.168.1.99     17:27    0.00s  0.17s  0.13s w

[notroot@athlon ~]# id root
uid=0(notroot) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

[notroot@athlon ~]# id notroot
uid=0(notroot) gid=0(root) groups=0(root)
But it's just a bad idea to change the first root/uid=0 entry.

Edited: never thought about sudo, but clearly that's another complication...

Last edited by tommylovell; 07-22-2011 at 04:56 PM.
 
Old 07-22-2011, 11:43 PM   #49
phenyloxime
LQ Newbie
 
Registered: Sep 2009
Posts: 28

Rep: Reputation: 2
superuser with an identity crisis?

go talk to the emacs psychiatrist
 
Old 07-23-2011, 02:51 AM   #50
littlejoe5
Member
 
Registered: Aug 2006
Location: Arizona
Distribution: ubuntu dirivatives mostly Mate
Posts: 260

Rep: Reputation: 19
Don't remember how it's done, but I have changed a users number. Most users users (in most distros) default to user id #1000. Some default to 500. I wanted all of my users (different distros) to be the same (since I am all of them), since I changed it to #1000.

I don't know if it would be possible to change a users ID # to #0. thereby giving him complete root privileges. Don't really think it would be a good idea. And I would hope that it would be more difficult than that to obtain root privileges.
 
Old 07-23-2011, 03:10 AM   #51
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by littlejoe5 View Post
Don't remember how it's done, but I have changed a users number. Most users users (in most distros) default to user id #1000. Some default to 500. I wanted all of my users (different distros) to be the same (since I am all of them), since I changed it to #1000.

I don't know if it would be possible to change a users ID # to #0. thereby giving him complete root privileges. Don't really think it would be a good idea. And I would hope that it would be more difficult than that to obtain root privileges.
There is no universally accepted standard for UID (and GID) numbers; the most complete scheme I found is in the Debian Policy statement here.

It is possible to change any user's UID to 0 which gives almost complete rootly powers (almost complete because some software is coded to look for the root user name instead of the 0 UID).
 
Old 07-23-2011, 06:24 AM   #52
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by littlejoe5 View Post
And I would hope that it would be more difficult than that to obtain root privileges.
Why? Only root (or whetever user has the UID 0) can change it in the first place.
 
  


Reply



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
[SOLVED] how can i remount root filesystem as read/write after modify readonly-root file jcwkyl Linux - Newbie 3 12-21-2010 10:40 PM
Adding root privaliges to user accounts or auto login as root Val-Ent Linux - General 15 03-02-2010 04:27 PM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:08 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
Open Source Consulting | Domain Registration