How to grant a user have root priviledge on Ubuntu12

来源:互联网 发布:西安市干部网络培训 编辑:程序博客网 时间:2024/06/05 06:58

Do to suggest to do this: still check the effect for now.


ok, this comes from my hacker days of trying everything in the system to see what it did.

There is a file /etc/passwd that famously holds passwords (or a marker to signify shadow passwords).

In that file, you will see something like this:

root:!:0:0::/:/usr/bin/kshdaemon:!:1:1::/etc:bin:!:2:2::/bin:sys:!:3:3::/usr/sys: adm:!:4:4::/var/adm:uucp:!:5:5::/usr/lib/uucp: guest:!:100:100::/home/guest:nobody:!:4294967294:4294967294::/:lpd:!:9:4294967294::/:lp:*:11:11::/var/spool/lp:/bin/false invscout:*:200:1::/var/adm/invscout:/usr/bin/kshnuucp:*:6:5:uucp login user:/var/spool/uucppublic:/usr/sbin/uucp/uucicopaul:!:201:1::/home/paul:/usr/bin/kshjdoe:*:202:1:John Doe:/home/jdoe:/usr/bin/ksh 

[example taken from here]

the two sections that are interest to us are the numbers in position 3 and 4. the first one is the user ID, the second is the group. Notice that in this installation (and most installations) the values for root are both 0

If you use su or sudo to edit this file, and change the numbers on your user ID to be the same as root, then you will become root. (also, you will not be able to use rmuser on your ID, as it is now considered essential to the system)



0 0
原创粉丝点击