How to detect kind of command for root only?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat How to detect kind of command for root only?
# 1  
Old 02-17-2012
How to detect kind of command for root only?

Dear all,

Please help me clarify why i cannot run command in /sbin directory (ex: /sbin/fdisk -l )!

I've checked permission on files which belong /sbin directory with execute permission. However, i still cannot run with normal user.

Sorry for my English.
thanks all,
# 2  
Old 02-17-2012
if fdisk has following permission
-rwxr-xr-x 1 root root 99400 2010-03-22 10:57 fdisk

Then you should be able to run this. try
/sbin/fdisk -h
you should be able to get the help page.

Now coming to the point where we talk about what fdisk does. fdisk is the command to manipulate the disk partition which other user can not, only root has access to do this.

summary..
you can run the fdisk command as other user but can not perform the disk operation using the command.

I hope i clear you doubt.
# 3  
Old 02-17-2012
Thanks Visal,

But i want to know exactly the difference between "run command" and "perform command" as you said.

I mean i can "perform": fdisk -h but cannot fdisk -l.

Additionally, how i can check or recognize what commands only perform by root because command to show permission (ls -la) not clear.

thanks all much,
# 4  
Old 02-17-2012
ok let me give you an example.

If you write a script in which you put some operation which only root can do, for example reading shadow file etc.. and make that script executable by everyone...
anybody can execute the script but script wont work for everyone, since they do not have access to read/write shadow file...
Here everybody can execute your script(run command) but can not perform the right function(perform action).

Same in this case fdisk is nothing but an executable file which is executable by anyone but operation mentioned in the file are not meant to be performed by them.

I hope its better with example.
This User Gave Thanks to vishal_vsh1 For This Post:
# 5  
Old 02-17-2012
Thanks Vishal much,
# 6  
Old 02-18-2012
Basically, only root should be running the administrative commands in /sbin and /usr/sbin. Non-root users may be technically able to run them - according to the file permissions - but many times the command will fail because the user does not have sufficient access to some resource that the command requires, such as the /proc or /dev filesystems. If you want to empower specific users to run specific commands as root, then set up sudo and use that.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Detect and run command upon mouse movement

I am trying to find a way to run a command upon any movement of a mouse. The 1st statement shows the mouse co-ordinates. So it can detect mouse movement. xinput test 9 First list input devices: $ xinput list If possible, I would like to use it in a bash script. (2 Replies)
Discussion started by: drew77
2 Replies

2. Shell Programming and Scripting

Htop - How to detect exact command running at background

Hello, I am running a python file from terminal and I wish to see which code is running at background. When I use htop, I see just a few commands, unable to see entire command. htop > report nano report Output: ^ Following parts of ffmpeg line is not shown by htop. Just showing... (7 Replies)
Discussion started by: baris35
7 Replies

3. Shell Programming and Scripting

Using grep command to detect presence of script run

i have this line of code on a korn shell script to detect the presence of script run: ISRUNNING=`ps -eaf -o args | grep -i sfs_load_file.ksh | grep -v grep | wc -l` sometimes this returns either 1, 2, or 3. when it returns 2 or 3 that tells us that there are more than 1 script of... (8 Replies)
Discussion started by: wtolentino
8 Replies

4. Solaris

Migration of system having UFS root FS with zones root to ZFS root FS

Hi All After downloading ZFS documentation from oracle site, I am able to successfully migrate UFS root FS without zones to ZFS root FS. But in case of UFS root file system with zones , I am successfully able to migrate global zone to zfs root file system but zone are still in UFS root file... (2 Replies)
Discussion started by: sb200
2 Replies

5. Shell Programming and Scripting

Perl-OS command to find out what kind

I need to know a command to find out which version of Perl Im currently running. Thanks Ben (2 Replies)
Discussion started by: bigben1220
2 Replies

6. AIX

how to detect removable disks or volume in AIX using command

Hi I am new to AIX and any help regarding the same would be really appriciated, thanks In advance. My priority issue is how to detect from command line that the volume / disk on AIX machine is a USB or removable disk /volume and if possible can we list out details for that disk / volume (1 Reply)
Discussion started by: mak_mailbox
1 Replies

7. UNIX and Linux Applications

How to automatically detect command failure

I have a shell script. In this script I executes various command and my requirement is such that if any command fails I've to terminate the shell script. To achieve this objective I'm checking the value of $? after each command and if its value is greater thaen I 'exit' the script. Is there... (2 Replies)
Discussion started by: ashok2008
2 Replies

8. UNIX for Dummies Questions & Answers

find command to detect installations

Hi I'm wondering how I can find all the files which were installed on certain date? For example: I'm looking for alle the files which were installed on the 11.09.06 on the system. Does somebody know how to do this? Thanks Reto (2 Replies)
Discussion started by: goldenglobe
2 Replies

9. UNIX for Dummies Questions & Answers

Run non-root script as root with non-root environment

All, I want to run a non-root script as the root user with non-root environment variables with crontab. The non-root user would have environment variables for database access such as Oracle or Sybase. The root user does not have the Oracle or Sybase enviroment variables. I thought you could do... (2 Replies)
Discussion started by: bubba112557
2 Replies

10. UNIX for Dummies Questions & Answers

Some kind of message command

Hello All, hope someone here can help me with this. I am a new unix system administrator on the HP-UX machine. Every night, our operators back up our file system using one tape but as of recently, our files have gotten bigger and it now requires 2 tapes for a complete backup. Since the operators... (3 Replies)
Discussion started by: sanjit
3 Replies
Login or Register to Ask a Question