The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
2answers
27 views

Changing root's passwords using setuid

Is is possible to change root's password using setuid? What I tried is writing a simple program which calls system("passwd root") owned by root and its setuid bit is set but it didn't work. The ...
-2
votes
1answer
54 views

non-root users can run passwd command as root, why can't they change password of root? [duplicate]

I know about setuid bit on /bin/passwd file which allows us (non-root user) to run that command as root user. running passwd command requires root permissions to change /etc/shadow file. My question ...
-3
votes
2answers
46 views

How are setuid, suid, sudo, and su all related? [duplicate]

I have a feeling the setuid bit, the nosuid mount option, sudo, and su are all related given their names. But how do they relate to one another? Are some of them used in conjunction? If they are not, ...
1
vote
1answer
21 views

Effect of nosuid on executables inside the mounted filesystem

Let it be known that I barely understand what setuid/setgid/whatever is. I think it has something to do with what user a program is executed as. This brings me to nosuid. In Security Enhancements in ...
1
vote
2answers
39 views

How to Backup and Compare File Permissions?

Is there a way you can setup a list of receipts of folders and directories of their correct default permissions that can be used as a backup to compare the correct permissions and be used to fix ...
3
votes
1answer
33 views

setuid example from Wikipedia: 4700

I was reading about setuid on Wikipedia. One of the examples goes as follows: 4700 SUID on an executable file owned by "root" A user named "tails" attempts to execute the file. The file ...
1
vote
1answer
31 views

why does setgid permission on an SO cause failures?

When I load a particular version of Python on a server, I get the following error: python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file ...
1
vote
1answer
16 views

Why won't this example of setUID work? [duplicate]

I am learning about setuid and setgid where the user executing the script will inherit the owner's permission while running the script. To test this, I created a bash as user fiverr in ...
0
votes
0answers
29 views

Linux - What resources require raised privileges C/C++ programming?

I am in the process of developing a daemon and user application which will talk to the daemon over a UNIX domain socket to send commands, get status information, etc. The user application will be run ...
1
vote
1answer
49 views

Why mac os x does not set uid bit for /usr/bin/passwd

A lot of books state that examples of setuid bit usages include passwd, at etc. But in mac os x el capitan, the /usr/bin/passwd does not have the bit set. How could it change the /etc/passwd file?
0
votes
1answer
69 views

Setuid does not work for my windows program hosted on a Linux server [closed]

I compiled ExpressI.exe on a Windows system with Visual C++. The file ExpressI.exe resides on a share mounted from Linux. I need to permit only the program ExpressI.exe to access the test folder ...
0
votes
1answer
25 views

Call setuid On Parent Process

From what I can tell you can only change a parent processes uid by messing with the kernel's address space, is there a better way? If I can only change the kernel's memory, how should I go about this? ...
2
votes
1answer
125 views

How to make new files have 0664 permissions rather than 0644?

I have a directory of subdirectory and files, with the files' permissions set at 0664. The directory and subdirectories are set at 2775, so all new files made have the same group set as the ...
1
vote
2answers
33 views

User verification

Suppose I've writen a setuid root executable and I want it to verify that the user is not a script by asking the user to provide his/her password (granted, users might save their password and use that ...
1
vote
2answers
96 views

Wrong eUID in `/proc/PID/status` when SETUID is used

While doing a wargame challenge, I ran into an issue with permissions. The info given by /proc/PID/status is not in adequation with the permissions that should be given to the processus. I am user ...
2
votes
0answers
31 views

Sed is unable to copy temporary file to original file [duplicate]

My aim is to edit the file (whose owner is user1) using a script where user2 doesn't have permission to directly edit the file but it should be edited when executed through script by user2. So I set ...
1
vote
1answer
117 views

Using find -perm to find setuid files

I want to find list of all suid binaries. I use the command find / -perm 4000 However this does not give me any output. I understand that the SUID file may be in 4xxx permission mode. But if I ...
1
vote
0answers
79 views

How to run a setuid program on Solaris 10?

I have a Solaris 10 system: # uname -a SunOS edddev03 5.10 Generic_150400-04 sun4v sparc SUNW,SPARC-Enterprise-T5120 I wrote a program printing the uid: # cat getuid.c int main (void) { printf ...
2
votes
1answer
301 views

How to start (or find) a process with RUID different from EUID?

Inspired by one of the previously answered questions, I tried executing a program by a user who was not its owner -- and the process's RUID and EUID remained the same. (Unless I read the answer wrong ...
4
votes
1answer
226 views

No output from locate command

I usually find the answers to all my Unix related problems already posted as questions and answers. However, this particular issue has had me stumped for the past hour so I thought I’d ask my first ...
2
votes
1answer
108 views

Setuid, SUID bit not providing root privileges

I've written and compiled a short program to allow any user to change the contents of my /sys/class/backlight/intel_backlight/brightness file, but I fail to escalate their permissions. What could I be ...
-2
votes
2answers
71 views

How can I identify if a binary file is set-user-ID? [closed]

In Linux, how can I identify if a binary file is set-user-ID? Can I use ls -l?
4
votes
1answer
2k views

Difference between owner/root and RUID/EUID

I am relatively new to the concepts mentioned in the question and reading about them from different sources only makes them more confusing. So this is what I understood so far: When we are given ...
0
votes
1answer
74 views

Not able to write a file when in the same group using PHP posix_setuid()

I'm running a PHP process from root which calls posix_setuid(1500); and then tries to open a file output.log The ls -l output.log shows this output: -rwxrwxr-x 1 www-data www-data 2294376 Mar 19 ...
0
votes
2answers
88 views

Why is the suid bit having no effect on a shell or perl script? [duplicate]

As an experiment in playing with the suid bit, I tried writing a script to run apt-get update from a bash script, and then set the suid bit on it, so I could just run ~/update or something. apt-get ...
0
votes
5answers
189 views

setuid (and other) permissions lost when copying / elsewhere - what to do?

I sort-of-cloned an existing Debian 7.x distro by copying the contents of the root filesystem (not the special dirs of course) to another HDD. I booted, things seem to run, but - I get some weird ...
2
votes
2answers
94 views

linux setuid does not work

I am learning linux suid,so I have written a small c program with the following content to test it #include<stdio.h> int main(){ system("echo 100 >> test.txt"); return 0; } -rwsr-xr-x 1 ...
-1
votes
2answers
84 views

Adding setuid permissions to a file

I am hosting a php application on my CentOS 5 server. The application runs some commands via a ssh file called openmgr. For that I want to give a permission of -rwsr-xr-x to the file. I tried chmod ...
0
votes
1answer
493 views

How to enable a non-root user to empty the linux buffer cache

I'm required to empty the linux buffer cache in a python script, that runs on a Debian wheezy VM. As root I run sync; echo 3 | sudo tee /proc/sys/vm/drop_caches, but the script is run by a user, ...
0
votes
1answer
326 views

crontab not executing my script?

I added this rule to the bottom of my crontab * * * * * /root/test.sh It basically resets iptables so I can fool around. If I mess up I won't be locked out of my box. When I run the script in bash ...
2
votes
1answer
123 views

Security of capabilities vs setuid (LD_PRELOAD, etc)

I know that if a process is run setuid that it's protected against various things that could subvert the process, like LD_PRELOAD and ptrace (debugging). But I haven't been able to find anything on ...
20
votes
2answers
8k views

Using the setuid bit properly

I have a process that needs root privileges when run by a normal user. Apparently I can use the "setuid bit" to accomplish this. What is the proper way of doing this on a POSIX system? Also, how ...
2
votes
2answers
456 views

print the /etc/shadow file in the console

How do I change the permissions of an executable file to access the /etc/shadow file? So far I have the following bash script: #!/bin/bash gcc print.c -o print chmod +s print ./print exit 0 and ...
1
vote
2answers
408 views

Why the S_ISUID and S_ISGID mode bits got cleared when the owner or group of an executable file are changed by an unprivileged user

I was reading the man page of chown. I don't understand why S_ISUID and S_ISGID mode should be cleared when the function returns successfully.
2
votes
2answers
444 views

what is the purpose of setuid enabled with no executable bit?

I am trying to understand permissions in detail. I was reading about setuid and it's uses. However, this particular case confuses me. I have made a small script and now I have set the suid bit for ...
1
vote
1answer
319 views

SUID-bit not working for executables within /tmp directory

Printing the value of getuid() and geteuid() from an executable with SUID-bit (chmod +s) turned-on, seems to result with the original caller ID instead of the owner id if the executable is located ...
2
votes
2answers
109 views

Why does FreeBSD require terminal programs to be started as root?

On FreeBSD all graphical terminal programs (e.g. xterm, rxvt) seem to be installed setuid root, or with setuid root wrappers. On Linux, this is not the case on any distribution I have ever used. Why ...
3
votes
1answer
244 views

Why doesn't Ubuntu use capabilities on ping?

After running, $ ls -l /bin/ping -rwsr-xr-x 1 root root 34740 Nov 5 2012 /bin/ping I wonder, why doesn't Ubuntu use capabilities (i.e. raw sockets) rather than setuid?
4
votes
2answers
2k views

Why setuid does not work on executable?

I know that enabling setuid on scripts has security issues and so is inactive by default, but expect that it works for executables. I created and executable which shows uid as an output following ...
4
votes
3answers
3k views

File permission with setuid and octal 4000

When we set setuid to a file, we do the following in the terminal: chmod u+s filename This works fine. But the octal number 4000 is always associated with setuid (in books etc). I understand (to ...
2
votes
1answer
183 views

Apache suexec won't work with strace

I have an Apache instance with mod_suexec enabled. I'm trying to debug a problem and am starting Apache with strace to try and see what's happening. However, when I start Apache like this: # strace ...
2
votes
1answer
103 views

Why isn't 'nethogs' installed with the setuid bit set?

I've been using nethogs for a while now, having to sudo every time, while ping has the setuid bit set. Today I set it for nethogs and it works: $ ls -l $(which nethogs) $(which ping) -rwxr-xr-x 1 ...
1
vote
0answers
91 views

Limit program execution to a list of arguments

I would like that my Unix users can only run a specific command insecurecommand with a controlled list of arguments stored in a file. The only solution I have found at this time is to : Create a ...
4
votes
3answers
3k views

How do I drop root privileges in shell scripts?

The "--up" option in OpenVPN is normally used for routing etc. And so it is processed before OpenVPN drops root privileges to run as nobody. However, I am invoking shell scripts that need to run as an ...
4
votes
1answer
2k views

Why does setuid not work? [duplicate]

I want to ensure that my program can only be run by user xyz using root privilege. To do this, I set the setuid bit with: chmod u+s program1.sh ls -l program1.sh rwsr-x--- 1 root house 1299 May 15 ...
2
votes
1answer
605 views

Using setuid Properly

I've been scared too much by the warning about setuid. However I cannot find a way around using it. I want to be able to run: arp -s 198.51.100.1 00:53:00:12:34:56 as the user steven but arp -s ...
5
votes
2answers
2k views

Group memberships and setuid/setgid processes

Processes which de-escalate privileges via setuid() and setgid() do not seem to inherit the group memberships of the uid/gid they set. I have a server process that must be executed as root in order ...
3
votes
1answer
1k views

How to let a user execute a script owned by root? Setuid doesn't seem to work anymore [duplicate]

I have some bash scripts that I use with the user 'root' to manage iptable rules. The problem is that I want these things at the same time: The script must be owned by root Permissions must be 700 ...
3
votes
2answers
319 views

using SUID bit to drop privileges

So this is a description of the system I'm working on : a "manager" process spawns all the other applications. The manager application runs as root user. so now, any process that it spawns also ...
1
vote
1answer
207 views

Principle of least privilege: Does Authbind helper really need setuid root, or can it run with cap_net_bind_services?

Does Authbind's helper really need setuid root, or can it run with the CAP_NET_BIND_SERVICES capability and still work?