LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-29-2014, 02:59 AM   #1
xeveri
LQ Newbie
 
Registered: Mar 2014
Location: Shandong,China
Distribution: slackware,win7
Posts: 10

Rep: Reputation: Disabled
Unhappy confused by set user id


I am new to linux and i choose slackware.
When learning set user id,i am confused about it.So i decide to try with a script.

#!/bin/bash
touch tryset

It was written by root in the home directory of user guo. After changing mod, it was
-rwsr--r-x root root ...
When running by root,the attribute of tryset is root.The attribute of it is guo when running by user guo.
I think the file attribute is root when running by guo due to setting user id...So what is the case ?
It seems the script must have x permission for others.
 
Old 04-29-2014, 04:24 AM   #2
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 226

Rep: Reputation: 90
Quote:
Originally Posted by xeveri View Post
I am new to linux and i choose slackware.
When learning set user id,i am confused about it.So i decide to try with a script.
For security reasons, SUID is disabled/ignored for shell scripts. I believe this is configurable when you compile the kernel, so caveat lector for other distros.

If you were to compile the following C code, and set the permissions of the resulting binary for SUID, things will work as one'd expect.

Code:
#include <stdio.h>

main()
{
   FILE *fp;
   unlink("/tmp/test.txt");
   fp = fopen("/tmp/test.txt", "w");
   fclose(fp);
}
Code:
root@faraday:~# gcc test.c -o /tmp/testsuid 
root@faraday:~# chmod u+s -v /tmp/testsuid 
mode of '/tmp/testsuid' changed from 0755 (rwxr-xr-x) to 4755 (rwsr-xr-x)
 
1 members found this post helpful.
Old 04-29-2014, 06:58 AM   #3
xeveri
LQ Newbie
 
Registered: Mar 2014
Location: Shandong,China
Distribution: slackware,win7
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks for your help. I'll test the example you give up.

Last edited by xeveri; 04-30-2014 at 03:19 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 website not public - confused on set up bengalman211 Linux - Server 9 07-12-2013 11:07 AM
confused about if default gateway is set right obiwannabe Linux - Networking 5 06-23-2013 07:40 AM
Please set me straight...I'm confused. littlebit Linux - Newbie 2 01-27-2008 06:10 PM
Confused about using Guardog to set up my firewall and configuration problems Michael_aust Linux - Software 1 04-25-2006 09:07 PM
Too Many Distro's ? New User's Confused ? rvijay Linux - Distributions 4 07-11-2004 08:33 AM


All times are GMT -5. The time now is 01:56 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration