The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
2answers
44 views

why suid bit is unset after file modification

I have an (s|g)uid file world-writable: ls -lh suid_bin.sh -rwsr-srwx 1 root root 168 mai 23 16:46 suid_bin.sh logged with a non-root user account. I use vi (or another editor) to modify ...
2
votes
3answers
128 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 ...
0
votes
0answers
20 views

Can't make SUID work [duplicate]

I have 2 users: root and usr345 in the system. SUID bit allows the users to execute a program with permissions of it's owner. I created a file: # touch /home/usr345/update-iptables.sh Contents: ...
2
votes
2answers
24 views

ptrace suid binaries after privilege is dropped

I understand that we probably cannot do ptrace on suid binaries. However, I'm wondering why we cannot do ptrace after the binary drops its previlege to uid instead of euid. For example, in the binary ...
9
votes
3answers
257 views

Set-uid executable and resulting process user

In Ubuntu 14.04, the passwd executable is -rwsr-xr-x 1 root root 47032 gen 27 01:50 /usr/bin/passwd and the ping executable is -rwsr-xr-x 1 root root 44168 mag 7 2014 /bin/ping so (for both) ...
2
votes
1answer
30 views

Darwin strips setuid from interpreter in hash bang execution

This is not exactly a question about how to run a hash bang script. In this situation, a hash bang script exists which doesn't (necessarily) have the u+s permission. Rather, the interpreter has u+s, ...
32
votes
6answers
2k views

What is the safest way for programmatically writing to a file with root privileges?

A huge application needs, at one specific time, to perform a small number of writes to a file which requires root permissions. It is not really a file but a hardware interface which is exposed to ...
4
votes
2answers
10k views

What does the 's' attribute in file permissions mean? [duplicate]

Please compare the following two lines: -rws---r-x 1 root root 21872 2009-10-13 21:06 prg1 -rwx---r-x 1 root root 21872 2009-10-13 21:06 prg2 Does the setuid bit on prg1, along with the read and ...
4
votes
3answers
149 views

What exactly differentiates the root user from every other user?

What are the fundamental differences between some arbitrary account and root? Is it just the UID being something other than zero? So, what exactly does the su binary do and how does it elevate a user ...
1
vote
1answer
33 views

SUID has no effect on directories with Linux

Why does the SUID bit have no effect when applied to directories in Linux? I clearly see that I can set it with 'chmod u+s'. But why does it not have "any" effect. What is the reason for implementing ...
1
vote
1answer
118 views

Directory permissions “r-s”, chmod 655 does not change to “r-x”, why?

I created a directory in my home directory. and I set its permission as follows: uhmwk.1.4$ chmod 655 dog uhmwk.1.4$ ls -l total 4 drw-r-sr-x 2 s9 s9 4096 Feb 14 21:57 dog why is the group ...
1
vote
2answers
57 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
145 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
75 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
2answers
75 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
56 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
57 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
1answer
38 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
20 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
43 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
111 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
75 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 ...
5
votes
1answer
3k 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 ...
0
votes
1answer
38 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
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 ...
2
votes
1answer
192 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
137 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 ...
1
vote
2answers
34 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 ...
5
votes
2answers
290 views

Running setuid binary temporarily without setuid?

Currently setting up xpra, which wants to run an X instance as non-root using the dummy driver, but the system Xorg binary is SUID. Since the system auto-updates, I would prefer not making and ...
1
vote
1answer
195 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 ...
100
votes
6answers
67k views

Allow setuid on shell scripts

The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor: > cat setuid-test.c #include <stdio.h> #include <unistd.h> int ...
1
vote
0answers
106 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
410 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
366 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
147 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
92 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?
7
votes
1answer
3k 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
94 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
101 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 ...
6
votes
2answers
6k views

Setuid bit seems to have no effect on bash

I was experimenting a bit and noticed something strange: setting the setuid bit on a copy of bash located at /usr/bin/bash-test seemed to have no effect. When I ran an instance of bash-test, my home ...
9
votes
2answers
6k views

Can gdb debug suid root programs?

I wrote a program that calls setuid(0) and execve("/bin/bash",NULL,NULL). Then I did chown root:root a.out && chmod +s a.out When I execute ./a.out I get a root shell. However when I do gdb ...
0
votes
5answers
269 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
105 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
102 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 ...
2
votes
2answers
795 views

setuid programs don't seem to run setuid in TinyCore Linux

I want to demonstrate the vulnerability of setuid programs using the TinyCore Linux live cd. That is, I craft a special program, with special permissions, so that it runs as the owner of the file ...
0
votes
1answer
660 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
372 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
176 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 ...
23
votes
2answers
12k 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
542 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 ...