Sponsored Content
Full Discussion: Changing effective user
Special Forums Cybersecurity Changing effective user Post 7060 by Perderabo on Tuesday 18th of September 2001 09:56:28 AM
Old 09-18-2001
It suid bit controls the switch of the effective uid. The sticky bit has nothing to do with it. And modern kernels will ignore the suid and sgid bits when executing scripts.

There is a program called "sudo" that can let a user run a script with another uid's authority. That is what I would recommend. sudo is a public domain program available from various archive sites.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Changing permissions of a user

So I need to change the permissions of my user account. I can access the root account on the server, but don't know how to change the permissions of my user account. I was advised to try 'userconf' to see if I am part of a group, but I dunno how that works. ANyone who knows how to see the... (3 Replies)
Discussion started by: achink125
3 Replies

2. UNIX for Dummies Questions & Answers

Changing the Effective Group ID

Here is my situation. On a RedHat 7.3 box, I have a user named jody. When I log in with jody and type in "id", I get the expected output: uid=1(jody) gid=1(jody) groups=1(jody), 510(test) However, I cannot figure which "id" option allows me to change the effective gid. I tried the options... (2 Replies)
Discussion started by: Jody
2 Replies

3. AIX

changing user password

I have 02 servers: - Linux RHEL AS 3 (server1) - AIX 5.2 (server2) Running the command rsh server2 passwd derje from the server1 to change derje user password on server2, give me this error: 3004-709 Error while changing the password for "derje" Can somebody help me ? (0 Replies)
Discussion started by: mayge
0 Replies

4. AIX

Changing User Characteristics

We use smitty to administer user accounts. Is it safe to make changes to the characteristics of a user while the user is logged in? Can I set "Is this user ACCOUNT LOCKED?" to true ? Can I set an expiration date on an account? Will this effect the user in anyway during their current... (1 Reply)
Discussion started by: andrewsc
1 Replies

5. Solaris

Solaris user changing password

i created 1 user . Now its passwd time period get expired. Now how can I set password for that user. Also how can I set a condition such a way that after every 3 months user must change his passwd. (5 Replies)
Discussion started by: ajitkraj
5 Replies

6. UNIX for Dummies Questions & Answers

Changing the user id or euid of the shell itself

Hi all, Ok, bear with me on this one, I am a bit new to Unix and it might take me a little bit of time to articulate my question. I know that every process has a user id and an effective user id. This seems to include the shell itself, because when I type 'ps', I see 'bash' listed as a... (2 Replies)
Discussion started by: oddthingy
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] effective user id upon exec

Hello all. Despite the exec man page, the exec system call seems to turn my effective-user-id into my real-user-id. I coded and compiled 2 very simple c programs as user 1 (uid=501) The first one (A) prints real and effective user IDs and then execs the second one (B), which in turn prints... (7 Replies)
Discussion started by: oviv
7 Replies

8. Shell Programming and Scripting

User id who is changing the script.

can we know the user id who changed saved script in cron tab..:D (7 Replies)
Discussion started by: netdbaind
7 Replies

9. Shell Programming and Scripting

Prevent the user from changing his directory

Hi could some let me know how to prevent user from changing his home directory....... Thanks in advance.... (1 Reply)
Discussion started by: Revanth547
1 Replies

10. Programming

Real, effective and saved user id in C program

I figured it out by now. (0 Replies)
Discussion started by: Ralph
0 Replies
CHMOD(2)						      BSD System Calls Manual							  CHMOD(2)

NAME
chmod, lchmod, fchmod -- change mode of file LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/stat.h> int chmod(const char *path, mode_t mode); int lchmod(const char *path, mode_t mode); int fchmod(int fd, mode_t mode); DESCRIPTION
The function chmod() sets the file permission bits of the file specified by the pathname path to mode. fchmod() sets the permission bits of the specified file descriptor fd. lchmod() is like chmod() except in the case where the named file is a symbolic link, in which case lchmod() sets the permission bits of the link, while chmod() sets the bits of the file the link references. chmod() verifies that the process owner (user) either owns the file specified by path (or fd), or is the super-user. A mode is created from or'd permission bit masks defined in <sys/stat.h>: #define S_IRWXU 0000700 /* RWX mask for owner */ #define S_IRUSR 0000400 /* R for owner */ #define S_IWUSR 0000200 /* W for owner */ #define S_IXUSR 0000100 /* X for owner */ #define S_IRWXG 0000070 /* RWX mask for group */ #define S_IRGRP 0000040 /* R for group */ #define S_IWGRP 0000020 /* W for group */ #define S_IXGRP 0000010 /* X for group */ #define S_IRWXO 0000007 /* RWX mask for other */ #define S_IROTH 0000004 /* R for other */ #define S_IWOTH 0000002 /* W for other */ #define S_IXOTH 0000001 /* X for other */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_ISVTX 0001000 /* sticky bit */ The mode ISVTX (the 'sticky bit') can be set on a regular file by the super-user, but has no effect. If mode ISVTX (the 'sticky bit') is set on a directory, an unprivileged user may not delete or rename files of other users in that directory. The sticky bit may be set by any user on a directory which the user owns or has appropriate permissions. For more information about the history and properties of the sticky bit, see sticky(7). Changing the owner of a file turns off the set-user-id and set-group-id bits; writing to a file turns off the set-user-id and set-group-id bits unless the user is the super-user. This makes the system somewhat more secure by protecting set-user-id (set-group-id) files from remaining set-user-id (set-group-id) if they are modified, at the expense of a degree of compatibility. RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
chmod() and lchmod() will fail and the file mode will be unchanged if: [ENOTDIR] A component of the path prefix is not a directory. [ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. [ENOENT] The named file does not exist. [EACCES] Search permission is denied for a component of the path prefix. [ELOOP] Too many symbolic links were encountered in translating the pathname. [EPERM] The effective user ID does not match the owner of the file and the effective user ID is not the super-user. [EPERM] The mode includes the setgid bit (S_ISGID) but the file's group is neither the effective group ID nor is it in the group access list. [EROFS] The named file resides on a read-only file system. [EFAULT] path points outside the process's allocated address space. [EIO] An I/O error occurred while reading from or writing to the file system. [EFTYPE] The effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory. fchmod() will fail if: [EBADF] The descriptor is not valid. [EINVAL] fd refers to a socket, not to a file. [EPERM] The effective user ID does not match the owner of the file and the effective user ID is not the super-user. [EPERM] The mode includes the setgid bit (S_ISGID) but the file's group is neither the effective group ID nor is it in the group access list. [EROFS] The file resides on a read-only file system. [EIO] An I/O error occurred while reading from or writing to the file system. [EFTYPE] The effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and fd does not refer to a direc- tory. SEE ALSO
chmod(1), chflags(2), chown(2), open(2), stat(2), getmode(3), setmode(3), sticky(7), symlink(7) STANDARDS
The chmod() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1''). HISTORY
The fchmod() function call appeared in 4.2BSD. The lchmod() function call appeared in NetBSD 1.3. BSD
October 11, 2011 BSD
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy