07-01-2002
Variables for Effective Username?
Hey all, I'm glad to have found this forum as I'm trying to dive head first into Solaris 8 - been working with it for a few months now and am finally getting a bit comfortable with the layout and concepts. In any case, on to the questions...
I was wondering how I would go about displaying the
Effective Username (for example if I login as user1 initially, then su to root, now my Effective Username is root) in the prompt on the system.
Currently $PS1 is set to: '[$LOGNAME : $PWD]$' and I'd like to replace $LOGNAME with their Effective Username so that when one su's to another username you don't forget whether you're still root, etc.
Thanks for your input!
8 More Discussions You Might Find Interesting
1. Cybersecurity
I would like to give execution rights for a script to one user. (that's the easy part...)
When that user is running the script, I would like the effective user ID to be that of the file-owner. Is this possible? (6 Replies)
Discussion started by: hilmel
6 Replies
2. UNIX for Dummies Questions & Answers
what's the most efficient and effective search for a file in a dir ?
I see many guys use this
# find - print
or something as such ? and sometimes pipe it to something else ?
Is there a better way of using "grep" in all of this ?
thanks
simon2000 (3 Replies)
Discussion started by: simon2000
3 Replies
3. UNIX for Dummies Questions & Answers
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
4. Shell Programming and Scripting
I am dealing with a very large firewall logfile (more than 10G),
the logfile like this
*snip*
Nov 9 10:12:01 testfirewall root:
Nov 9 10:12:01 testfirewall root: 0:00:11 accept testfw01-hme0 >hme0 proto: icmp;
src: test001.example.net; dst: abc.dst.net; rule: 1; icmp-type: 8;... (8 Replies)
Discussion started by: fedora
8 Replies
5. UNIX for Dummies Questions & Answers
Can anyone explain me in details of Real and Effective IDs (6 Replies)
Discussion started by: kkalyan
6 Replies
6. UNIX for Dummies Questions & Answers
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
7. Cybersecurity
I was looking for a good list of words to exclude people from using as passwords, i.e. those that could be guessed easily. I'm working through a whole bunch of suggestions from skullsecurity.org, but I managed to find this page that seems to suggest I have more options than I thought. :b:
I... (1 Reply)
Discussion started by: rbatte1
1 Replies
8. UNIX for Beginners Questions & Answers
Greetings,
The title pretty much says it all. I've snooped everywhere and can't find anything on this. Since our organization went to numeric usernames, using the u|U option for ps returns no processes. Example passwd entry:
320074:DjZAJKXun8HBs:10129:6006:Joe Y:/cadhome/analysis/jy:/bin/bash... (4 Replies)
Discussion started by: crimso
4 Replies
LEARN ABOUT CENTOS
cap_get_file
CAP_GET_FILE(3) Linux Programmer's Manual CAP_GET_FILE(3)
NAME
cap_get_file, cap_set_file, cap_get_fd, cap_set_fd - capability manipulation on files
SYNOPSIS
#include <sys/capability.h>
cap_t cap_get_file(const char *path_p);
int cap_set_file(const char *path_p, cap_t cap_p);
cap_t cap_get_fd(int fd);
int cap_set_fd(int fd, cap_t caps);
Link with -lcap.
DESCRIPTION
cap_get_file() and cap_get_fd() allocate a capability state in working storage and set it to represent the capability state of the pathname
pointed to by path_p or the file open on descriptor fd. These functions return a pointer to the newly created capability state. The
effects of reading the capability state from any file other than a regular file is undefined. The caller should free any releasable mem-
ory, when the capability state in working storage is no longer required, by calling cap_free() with the used cap_t as an argument.
cap_set_file() and cap_set_fd() set the values for all capability flags for all capabilities for the pathname pointed to by path_p or the
file open on descriptor fd, with the capability state identified by cap_p. The new capability state of the file is completely determined
by the contents of cap_p. A NULL value for cap_p is used to indicate that capabilities for the file should be deleted. For these func-
tions to succeed, the calling process must have the effective capability, CAP_SETFCAP, enabled and either the effective user ID of the
process must match the file owner or the calling process must have the CAP_FOWNER flag in its effective capability set. The effects of
writing the capability state to any file type other than a regular file are undefined.
RETURN VALUE
cap_get_file() and cap_get_fd() return a non-NULL value on success, and NULL on failure.
cap_set_file() and cap_set_fd() return zero on success, and -1 on failure.
On failure, errno is set to EACCES, EBADFD, ENAMETOOLONG, ENOENT, ENOMEM, ENOTDIR, EPERM, or EROFS.
CONFORMING TO
These functions are specified by withdrawn POSIX.1e draft specification.
NOTES
Support for file capabilities is provided on Linux since version 2.6.24.
On Linux, the file Effective set is a single bit. If it is enabled, then all Permitted capabilities are enabled in the Effective set of
the calling process when the file is executed; otherwise, no capabilities are enabled in the process's Effective set following an
execve(2). Because the file Effective set is a single bit, if any capability is enabled in the Effective set of the cap_t given to
cap_set_file() or cap_set_fd(), then all capabilities whose Permitted or Inheritable flag is enabled must also have the Effective flag
enabled. Conversely, if the Effective bit is enabled on a file, then the cap_t returned by cap_get_file() and cap_get_fd() will have the
Effective flag enabled for each capability that has the Permitted or Inheritable flag enabled.
SEE ALSO
libcap(3), cap_clear(3), cap_copy_ext(3), cap_from_text(3), cap_get_proc(3), cap_init(3), capabilities(7)
2008-05-11 CAP_GET_FILE(3)