views:

127

answers:

3

Hi,

I have a requirement to run a java jar on a low privilege user on linux.

e.g. If I am currently logged in as a 'root' user and want to execute a shell script that should run with the privileges of a low privileged linux user like 'postix' user account.

Is it possible?

If yes, please post relevant references as I don't know how to do it.

Thanks in advance

Ashish

+3  A: 

you can use the sudo command to run the script as another user. If its set up properly, you can use it like this

sudo -u andrew myprog

will run myprog as the user andrew

Andrew Keith
+1  A: 

Not sure what you mean by priority. If you think about scheduling priority, you can use the nice command to run the script with low priority on the CPU. Being logged as 'root' does not give any scheduling priority.

Besides this, it is always a bad idea to be logged in as 'root'.

Didier Trosset
with the privileges of low priority linux if i understood correctly, "privileges" is more important then "priority" in this sentence.
Maciek Sawicki
my mistake, I meant 'low privilege' instead of 'low priority'
Ashish
+1  A: 

I think sudo should do the trick .

You can also create script that will run your app change its owner and set suid bit for it

useful commands: chmode, chown

Maciek Sawicki