09-14-2010
Hi,
it depends on what shell You use, but in bash, "su - user" alone gives You an interactive shell. But the "-c" option (and some others I think) actively creates a non-interactive shell, because it reads commands from a file (more or less). Depending on shell, different resource files are read and hence different environments.
/Lakris
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey all,
Just wanted to get some input on a script I am using to import files into a MySQL database.
The process is pretty simple: my main server exports these files and FTPs them. I have a script that FTPs them to the machine running that runs this script. The FTP script runs without issue... (2 Replies)
Discussion started by: billtwild
2 Replies
2. Shell Programming and Scripting
I have a simple csh-script on a Solaris Workstaion which invokes the bc calculator:
#!/bin/csh
set shz=2
set zshift=5
set shzp=`bc -l <<END \
scale = 3 \
-1. * $shz + $zshift \
END`
echo $shzp
The result ($shzp) in this case is 3 (-1*2+5). It works fine on Solaris 8.
... (2 Replies)
Discussion started by: two reelers
2 Replies
3. Windows & DOS: Issues & Discussions
Hi,
I have an awk script which performs simple operations of variable assignments and finally printing the variables in custom form.
BEGIN {FS=OFS="\n"}
{
v1=substr($0,1,15)
v2=substr($0,16,200)
v3=substr($0,216,20)
print v1 "|" v2 "|" v3
}
The input file being processed... (2 Replies)
Discussion started by: vidyak
2 Replies
4. Shell Programming and Scripting
Hi,
I was using mpack to send mails using cronjob with attachments. It was working perfect. But recently it's behaving strangely. Its sending the mails without any error message but the mail is not getting delivered.
The code I was using:
/usr/local/bin/mpack -s "$SUBJECT" -d $MSGBODY... (0 Replies)
Discussion started by: itesh.dash
0 Replies
5. AIX
$cat /tmp/tuxob.lst
udi *****
jim 10
ant 19
ibm *****
$ input=`head -1 /tmp/tuxob.lst | awk '{print $NF}'`
$ echo $input
The output I am expecting is '*****'. But It is showing me the available files of current directory. When I run the command
head -1 /tmp/tuxob.lst | awk '{print $NF} ... (3 Replies)
Discussion started by: panchpan
3 Replies
6. Shell Programming and Scripting
Hi have a script which transferers from Microsoft server to Linux box.
The scripts(ksh) is on Linux box.
If I run script from terminal, it transfers files to directory. Where as If
I run script from CRON. It does not.
Here is the log of both:
Terminal execution log:... (2 Replies)
Discussion started by: dipeshvshah
2 Replies
7. Shell Programming and Scripting
Hi,
i have script called script.ksh
script.ksh
---------
echo "Narayana" >$HOME/script.log
echo "$0" |sed 's/.ksh//' >>$HOME/script.log
My question is:
--------------
when iam executing on the prompt it is giving good results what we have expected...
example on the prompt:... (4 Replies)
Discussion started by: lnviyyapu
4 Replies
8. Linux
Hi,
I have a question on web servers and network switches.
Why a network switch should support certificate management, that means generating public and private keys... installing a certificate etcetra.
Regards
Chaitanya. :b: (4 Replies)
Discussion started by: chaitus.28
4 Replies
9. Shell Programming and Scripting
Here is my test script:
#!/bin/sh
result=`jobs`
echo "
Jobs:
"$result
result=`ls`
echo "
LS
"$result
Here is the output:
Jobs:
LS
0 1 2 3 4 5 6 7 gcd initialize.sh #inter_round_clean.sh# inter_round_clean.sh inter_round_clean.sh~ look parallel_first_run.sh... (3 Replies)
Discussion started by: nealh
3 Replies
10. UNIX for Beginners Questions & Answers
Our application fails to run successfully on Solaris 11. The same works fine in Solaris 10.
Due to which we are unable to migrate to Solaris 11. The app basically involves forking a child process, which finally connects with parent process. But on Solaris 11, it is unable to connect with parent... (0 Replies)
Discussion started by: wini008
0 Replies
su(1) General Commands Manual su(1)
NAME
su - Substitutes user ID temporarily
SYNOPSIS
su [- | -f] [user] [shell_option] [shell_command]
OPTIONS
Prevents the user's shell initialization file from being executed by passing the -f option to the user's shell, thus making su start up
faster. The -f option is supported by the csh family of shells. Simulates a full login by executing the commands in either the and files
for csh or the file for sh and ksh and by setting the current working directory to the user's home directory. Passes the specified shell
option flag to the newly invoked user's shell for execution. The shell_option must be supported by the invoked shell. The csh, sh, ksh, and
any other interactive command shell support the commonly used -c shell option. By default (no "shell_option"), the shell is opened with the
-i (interactive) shell option. See the reference page for the shell you are using for more information on the shell options. Passes the
specified command to the newly invoked user's shell for execution. The shell_command must be supported by the invoked shell.
DESCRIPTION
The su command demands the password of the specified user, and if it is given, changes to that user and invokes the user's shell without
changing the current directory.
Except in a case where the - option is used, the user environment is unchanged except for HOME, SHELL, USER, and LOGNAME which are taken
from the password file for the user being substituted (see environ). The new user ID stays in force until the shell exits.
If no user is specified, root is assumed. Only users who belong to group number 0 (system) can issue su to become root, even with the root
password. To remind superusers of their responsibilities, the shell substitutes a # (number sign) for its usual prompt.
Shell commands may be passed to the shell that is spawned by su by including them on the command line after the su flags and arguments.
After the flags recognized by su and the user argument are processed, unrecognized command line flags (shell_options) and/or arguments
(shell_commands) are passed to the shell for execution. If the spawned shell does not support the command or the format of the command, the
command is not executed and the resulting shell behavior and error messages are determined by the shell.
Security Restrictions
The su command fails if any lock conditions exist on the target account. Specifically, if the destination account was retired, if the num-
ber of unsuccessful login attempts exceeds the maximum allowed, if the administrative lock was applied, or the password's lifetime was
exceeded, the Information System Security Officer (ISSO) must unlock the destination account before any user can log in to it or use su to
transition to it.
SECURITY NOTE
This security-sensitive command uses SIA (Security Integration Architecture) as an interface to the security mechanism(s) that perform the
actual user validation. See the matrix.conf(4) reference page for more information.
ENVIRONMENT VARIABLES
The following environment variables affect the behavior of su:
SEE ALSO
Commands: csh(1), ksh(1), sh(1)
su(1)