-
Suid root seems not to work - Getting SUIDcidal ;-)
Greetings!
As I'm using Kanotix (which doesn't seem to have such an extensive forum) and it's based on Knoppix, I figure I'll post this question here.
For a program which will use the parallel port for digital I/O, I'm trying to get access to the port WITHOUT being root (no sudo, either). For this, I've compiled a simple program in C, but it keeps complaining it has no permissions to access the port (/dev/parport0). Port permissions are as follows:
Code:
crw-rw-rw- 1 root root 99, 0 Feb 9 19:40 /dev/parport0
The program has been compiled using gcc -O1 -o test test.c, after which I've issued (as root):
Code:
chown root:users test
chmod u+s test
I figured it should work now, but it doesn't. Keeps complaining about permissions.
Furthermore I've tried creating a file foo.txt and done chmod 600 foo.txt. Then made an executable script bar.sh, which just cat's foo.txt. Then:
Code:
chown root:users bar.sh
chmod u+s bar.sh
Executing bar.sh also gives permission errors. So in other words: what gives? I'm stumped, but I've probably misunderstood how suid root works. Any help would be greatly appreciated.
Thanks in advance,
Marc.
-
Solved - sort of
Well, that wasn't too hard. After putting my program in a directory in the path, all seems well. OTOH, it doesn't work when it's in a directory that only belongs to my personal path. Does it have to be in the root's path somewhere?
-
Senior Member
registered user
Re: Solved - sort of
That's weird, man. 

Originally Posted by
mvandoornik
Well, that wasn't too hard. After putting my program in a directory in the path, all seems well. OTOH, it doesn't work when it's in a directory that only belongs to my personal path. Does it have to be in the root's path somewhere?
-
Senior Member
registered user
If Kanotix is similar Knoppix I guess the $PATH variable for root has a different (more restricted) set of paths to a normal user. This is partly for security.
This can be tested by followed by <enter> at a terminal window. Do this for root and for a normal user and see if this helps explain what has happened.
-
Senior Member
registered user
I think you meant:
echo $PATH

Originally Posted by
markpreston
If Kanotix is similar Knoppix I guess the $PATH variable for root has a different (more restricted) set of paths to a normal user. This is partly for security.
This can be tested by
followed by <enter> at a terminal window. Do this for root and for a normal user and see if this helps explain what has happened.
-
Senior Member
registered user
> Executing bar.sh also gives permission errors.
The suid permission bit is ignored for scripts for security reasons. Suid for "true" executables only give the *effective* UID,
not the *real* UID. This can make a difference, e.g. as in cpio.
-
Senior Member
registered user
Hi Dave,
$PATH alone works as well for this.
mark@z:~$ $PATH
bash: /home/mark/.dist/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games:.: No such file or directory
mark@z:~$
mark@z:~$ su
Password:
root@z:/home/mark# $PATH
bash: /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games: No such file or directory
root@z:/home/mark#
I think you meant:
echo $PATH
-
Senior Member
registered user
--Yes, but it's not proper *nix form to try and _execute_ your PATH variable. Somebody could attack you that way. 

Originally Posted by
markpreston
Hi Dave,
$PATH alone works as well for this.
mark@z:~$ $PATH
bash: /home/mark/.dist/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games:.: No such file or directory
mark@z:~$
mark@z:~$ su
Password:
root@z:/home/mark# $PATH
bash: /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games: No such file or directory
root@z:/home/mark#
I think you meant:
echo $PATH
-
Senior Member
registered user

Originally Posted by
Dave_Bechtel
--Yes, but it's not proper *nix form to try and _execute_ your PATH variable. Somebody could attack you that way.

Thanks Dave,
At least I now know what you were concerned about.
Regards,
Mark
Similar Threads
-
By pterandon in forum General Support
Replies: 0
Last Post: 06-04-2006, 03:41 AM
-
By GameMage in forum General Support
Replies: 2
Last Post: 11-12-2005, 06:44 AM
-
By lestat730 in forum Hdd Install / Debian / Apt
Replies: 8
Last Post: 01-20-2005, 07:05 AM
-
By jackren in forum Hdd Install / Debian / Apt
Replies: 0
Last Post: 08-29-2003, 01:02 PM
-
By in forum General Support
Replies: 6
Last Post: 01-27-2003, 05:18 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

(New) AMD Ryzen 7 5700X 8 Core 16 Thread AM4 Unlocked 3.4 GHz CPU OEM Tray
$174.99

AMD Ryzen 7 PRO 8700GE 8-Core/16-Thread Up to 5.1GHz AM5 (FL1)
$175.00

OPNsense Firewall 8-Core Atom C3758 4GB DDR4 RAM 64GB SSD 8x 1Gbe QAT AES-NI VPN
$95.00

Clear Touch Interactive Module CTI PCMOD PC55 ST i5 6core,8GB DDR4,256GB SSD NEW
$225.00

Lenovo ThinkCentre M720Q Core i5-8500T 2.10GHz 8GB 128GB SDD W11 Mini PC (Z3675)
$125.96

Dell Optiplex 7070 8-Core i7-9700 3.0ghz 8GB DVDRW NO SSD Tower PC Computer
$169.99

AMD Ryzen 7 9850X3D 8-Core 16-Thread 5.6GHz 120W AM5 CPU 100-100001973WOF
$435.99

AMD Ryzen 7 9800X3D 8-Core 16-Thread AM5 Zen 5 Desktop Processor NEW
$399.00

Apple Mac Pro (A1186, "8Core" 2007)Xeon X5365-4GB Ram 1TB HDD OS XLeopard NVIDIA
$274.99

Dell Optiplex 7070 SFF i7-9700 8-Core 3.0GHz 16B Ram NO HDD NO OS
$199.99