Sponsored Content
Full Discussion: SU info
Top Forums UNIX for Dummies Questions & Answers SU info Post 60642 by RTM on Wednesday 19th of January 2005 09:59:55 PM
Old 01-19-2005
If you login as root on console, you get root's environment set up - which may include more paths to commands/libraries/whatever.

If you su - root, it would be the same as logging in as root.

If you su root, you are only getting the priviledges of root, but the environment is yours, which may not include the correct paths to do some commands.

This is one example!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

some info on awk please

i know this is a stupid question but...can awk do more than print? can i have it assign a value from a file list to a variable in the script? (1 Reply)
Discussion started by: MadHatter
1 Replies

2. UNIX for Dummies Questions & Answers

Extracting Info

i have a file that contain lines like this 9.4.7.8.5.7.9.0.5.7.1.2.msisdn.sub.cs. 1 IN CNAME SDP01.cs. there are about 50,000 lines like this in the files i want to the extract the digits from the above line like:- 947857905712 OS Solaris9 (3 Replies)
Discussion started by: muneebr
3 Replies

3. Shell Programming and Scripting

Merging info

Hi, pls advise how could we merge contents of lines from 2 different files into 1 file but shares common label continously as in the following example: Thanks in advance...rgds. File1: // line: 0 abc def // line: 1 ghi jkl File2: // line: 0 mno pqr // line: 1 stu vwx End... (3 Replies)
Discussion started by: Manan
3 Replies

4. Solaris

UFSDUMP info

Hi,,,,, My question is : i have to backup a file system of size 92 GB /dev/dsk/c1t1d0s2 135G 92G 41G 70% /data i use the command : ufsdump 0cfu /backup/c1t1d0s2 /dev/rdsk/c1t1d0s2 ...... the output file of the backup is only 2 GB it's normal ?? or i have do a... (0 Replies)
Discussion started by: tt155
0 Replies

5. Shell Programming and Scripting

last logged on info

Hi how can I know the details of when valid system users last logged on? thanks (1 Reply)
Discussion started by: nokia1100
1 Replies

6. Shell Programming and Scripting

Need Info

Hi, I'm a oracle DBA with little knowledge of Unix. I wanted to write some shell scripts which will be helpful for DBA's regular activity. As i'm a new to oracle with unix can any plese tell me what are all the activities can be done throgh Unix Shell Scripts also suggest me how to learn... (1 Reply)
Discussion started by: msgobinathan
1 Replies

7. Forum Support Area for Unregistered Users & Account Problems

Update my info

I hadn't logged on here in several months. I want to update my info, such as the email address that I can be contacted at, but I don't see any links to do that. (1 Reply)
Discussion started by: cleopard
1 Replies

8. UNIX for Dummies Questions & Answers

Some Info.

Hiya all ... i am a newbie to UNIX, Just want to knwo what this command does: /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' I think, 'grep shows the line with 'inet addr' (which is the 2nd line, displaying the IP Address, Broadcast Address and Subnet Mask) ... Is... (8 Replies)
Discussion started by: ad4m88
8 Replies

9. Shell Programming and Scripting

Getting LV Info

I have this working ksh, and it returns like below: LOGICAL VOLUME: prod_2048_005 VOLUME GROUP: prod1vg TYPE: raw WRITE VERIFY: off PHYSICAL VOLUME: hdisk108 VOLUME GROUP: prod1vg TOTAL PPs: 1023 (130944 megabytes) VG DESCRIPTORS: 1 USED PPs: 904 (115712 megabytes) MAX REQUEST: 1 megabyte... (1 Reply)
Discussion started by: Daniel Gate
1 Replies

10. UNIX for Advanced & Expert Users

Getting machine info in C

I need to find a way to query the OS (on Linux or Unix) to get details about the host machines processor type and the primary hard drive serial number. Is this possible? Thank you for any Guru help you can provide! (2 Replies)
Discussion started by: Pug
2 Replies
su(1M)							  System Administration Commands						    su(1M)

NAME
su - become superuser or another user SYNOPSIS
su [-] [username [arg...]] DESCRIPTION
The su command allows one to become another user without logging off or to assume a role. The default user name is root (superuser). To use su, the appropriate password must be supplied (unless the invoker is already root). If the password is correct, su creates a new shell process that has the real and effective user ID, group IDs, and supplementary group list set to those of the specified username. Additionally, the new shell's project ID is set to the default project ID of the specified user. See getdefaultproj(3PROJECT), setpro- ject(3PROJECT). The new shell will be the shell specified in the shell field of username's password file entry (see passwd(4)). If no shell is specified, /usr/bin/sh is used (see sh(1)). If superuser privilege is requested and the shell for the superuser cannot be invoked using exec(2), /sbin/sh is used as a fallback. To return to normal user ID privileges, type an EOF character (CTRL-D) to exit the new shell. Any additional arguments given on the command line are passed to the new shell. When using programs such as sh, an arg of the form -c string executes string using the shell and an arg of -r gives the user a restricted shell. To create a login environment, the command "su -" does the following: o In addition to what is already propagated, the LC* and LANG environment variables from the specified user's environment are also propagated. o Propagate TZ from the user's environment. If TZ is not found in the user's environment, su uses the TZ value from the TIMEZONE parameter found in /etc/default/login. o Set MAIL to /var/mail/new_user. If the first argument to su is a dash (-), the environment will be changed to what would be expected if the user actually logged in as the specified user. Otherwise, the environment is passed along, with the exception of $PATH, which is controlled by PATH and SUPATH in /etc/default/su. All attempts to become another user using su are logged in the log file /var/adm/sulog (see sulog(4)). SECURITY
su uses pam(3PAM) with the service name su for authentication, account management, and credential establishment. EXAMPLES
Example 1 Becoming User bin While Retaining Your Previously Exported Environment To become user bin while retaining your previously exported environment, execute: example% su bin Example 2 Becoming User bin and Changing to bin's Login Environment To become user bin but change the environment to what would be expected if bin had originally logged in, execute: example% su - bin Example 3 Executing command with user bin's Environment and Permissions To execute command with the temporary environment and permissions of user bin, type: example% su - bin -c "command args" ENVIRONMENT VARIABLES
Variables with LD_ prefix are removed for security reasons. Thus, su bin will not retain previously exported variables with LD_ prefix while becoming user bin. If any of the LC_* variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY) (see environ(5)) are not set in the environment, the operational behavior of su for each corresponding locale category is determined by the value of the LANG environment vari- able. If LC_ALL is set, its contents are used to override both the LANG and the other LC_* variables. If none of the above variables are set in the environment, the "C" (U.S. style) locale determines how su behaves. LC_CTYPE Determines how su handles characters. When LC_CTYPE is set to a valid value, su can display and handle text and filenames containing valid characters for that locale. su can display and handle Extended Unix Code (EUC) characters where any indi- vidual character can be 1, 2, or 3 bytes wide. su can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid. LC_MESSAGES Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses. In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English). FILES
$HOME/.profile user's login commands for sh and ksh /etc/passwd system's password file /etc/profile system-wide sh and ksh login commands /var/adm/sulog log file /etc/default/su the default parameters in this file are: SULOG If defined, all attempts to su to another user are logged in the indicated file. CONSOLE If defined, all attempts to su to root are logged on the console. PATH Default path. (/usr/bin:) SUPATH Default path for a user invoking su to root. (/usr/sbin:/usr/bin) SYSLOG Determines whether the syslog(3C) LOG_AUTH facility should be used to log all su attempts. LOG_NOTICE mes- sages are generated for su's to root, LOG_INFO messages are generated for su's to other users, and LOG_CRIT messages are generated for failed su attempts. /etc/default/login the default parameters in this file are: TIMEZONE Sets the TZ environment variable of the shell. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), env(1), ksh(1), login(1), roles(1), sh(1), syslogd(1M), exec(2), getdefaultproj(3PROJECT), setproject(3PROJECT), pam(3PAM), pam_authenticate(3PAM), pam_acct_mgmt(3PAM), pam_setcred(3PAM), pam.conf(4), passwd(4), profile(4), sulog(4), syslog(3C), attributes(5), environ(5) SunOS 5.11 26 Feb 2004 su(1M)
All times are GMT -4. The time now is 01:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy