Search Results

Search found 1 results on 1 pages for 'n00bincpp'.

Page 1/1 | 1 

  • running a command as root with /bin/su and without gives different results

    - by n00bInCpp
    Some background: I have a machine with SLES 11 installed. I am running a bash script that one of its lines is /bin/su $USER -c SOME_CMD. Unfortunately, the SOME_CMD that comes after the -c keeps failing, no matter if USER=root or any different user. However, if /bin/su $USER -c part is omitted then everything runs smoothly. Moreover, I have run the script on RHEL5 and it worked fine. Anyway, my question is why does it happen? If it is a permissions problems then why when I run this as root with /bin/su and without I get different results? P.S. apologize if somebody else has asked it before, I have done many googling and got nothing that satisfies. Thanks in advance, n00bInCpp EDIT Okay, I figured it out, I hope so. Instead of running /bin/su I used /user/bin/sudo -u $MY_USER_1 MY_ENV_VAR="/home/user1" SOME_CMD. I don't understand why I have to use sudo, though. I am used to run a command as a different user using su and not worrying about permissions problems, but I guess it doesn't work like that on SLES 11/SuSE. Anyhow, thanks to everyone who wanted to or helped me.

    Read the article

1