Tuesday, December 31, 2013

Giving Root Previleges to a Normal user

1. [root@testmachine Desktop]# cat /etc/sudoers

## Allow root to run any commands anywhere 
root ALL=(ALL) ALL


2. [root@testmachine Desktop]# vi  /etc/sudoers
  
go to the below line.. and add these ..

## Allow root to run any commands anywhere 
root ALL=(ALL) ALL
appu ALL=(ALL) ALL


Save and Quit.


we have given root privileges to the normal user appu.

4. To test. Login as normal user.

[appu@testmachine Desktop]$ fdisk -l

bash: /sbin/fdisk: Permission denied

So, use "sudo" before the command, it will ask you for the password. Enter your login password. If the password is correct, it will display  O/P to STDOP device(bash).

[appu@testmachine Desktop]$ sudo fdisk -l

[sudo] password for appu:*******

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b17

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              39        1179     9161728   83  Linux
/dev/sda3            1179        1306     1015808   82  Linux swap / Solaris

1 comment: