Showing results for 
Search instead for 
Did you mean: 

Set User Id

Occasional Advisor

Set User Id

please anyone can tell me about set user id.
How it works & what's the use of it?

Thanx in advance
Stuart Browne
Honored Contributor

Re: Set User Id

It really depends on what you're wanting to set the user id of.

If you're wanting to create a user with a specific UID, then 'useradd -u ' will create it.

If you want to launch a process as a given user, depending on the process, you can just 'su - -c '.

If it's a daemon process however (such as squid or apache), there's usually daemon configuration values which say which user they drop their privileges to ('cache_effective_user' and 'User' respectivly in these two cases).

If this isn't what you're after, more details please.
One long-haired git at your service...
Ivan Ferreira
Honored Contributor

Re: Set User Id

If you talk about SUID bit, "chmod u+s", this means that a program will run with the privileges of the owner of the file instead of the user who runs the program.

For example, if /bin/rm is owned by root, without SUID bit, if user1 runs the command /bin/rm -fr /root, it will run as user1, and he won't be able to delete the files in /root as user1 has no permissions.

If /bin/rm is owned by root, and it has SUID bit enabled, if user1 runs the command /bin/rm -fr /root, it will run as "root" (the owner of the program), and will be able to delete the /root directory.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Honored Contributor

Re: Set User Id

What Ivan said sounds reflecing to your needs. Please explain your scenario.
Regular Advisor

Re: Set User Id


I hope this link will be helpful...

Everything is Possible and Anything is Feasible if u try