Re: Set User Id

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).

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?