10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to switch from local user to root user in a shell script.
I need to make it automated so that it doesn't prompt for the root password.
I heard the su command will do that work but it prompt for the password.
and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies
2. UNIX for Dummies Questions & Answers
sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
3. Shell Programming and Scripting
Hi , we got autosys for scheduling our jobs. Autosys user logs in to the Linux box and need to execute a shell script. problem here is user requires admin privileges on database to complete the task. Since scheduling is maintained by different team I don't want autosys user to have admin privileges... (1 Reply)
Discussion started by: rush143
1 Replies
4. UNIX for Advanced & Expert Users
Hi,
We need to configure user in c shell with the following format when he tries to login to the system for SOLARIS 9 OS
username@hostname>
Let me know the steps for the confiuring the user login as per the requirement.. (2 Replies)
Discussion started by: hydoss1
2 Replies
5. Shell Programming and Scripting
Hi Every body,
I would need a shell script program to login as different user and perform some copy commands in the script.
example: Supppose ora_toms is the active user
ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands
... (9 Replies)
Discussion started by: ujjwal27
9 Replies
6. UNIX for Dummies Questions & Answers
for example, if we specify,#!/usr/bin/ksh then the script will be executed in korn shell.
If we don't specify that line, the script will be executed using the default shell.
So, how we can identify the default shell for the current user?
Will it be in .profile file ?
Thanks (13 Replies)
Discussion started by: pandeesh
13 Replies
7. Shell Programming and Scripting
Hi All
I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh
URL="www.google.com"
VBURL="10.5.2.211"
echo "Setting route for $URL for GPRS"
URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1`
echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies
8. Shell Programming and Scripting
Hi all,
I am trying to eject the cdrom from a livecd after certain stage...
Now assuming that it is possible to eject,please consider my issue!!!
The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive...
However if i try pfexec eject it... (3 Replies)
Discussion started by: wrapster
3 Replies
9. UNIX for Dummies Questions & Answers
Hi,
is it possible to chnage the user in a shell script?
i would like to create a script with should make some actions on the host which needs root permissions.
i want do give the user which should start the script the root permissions.
so is it possible to make a command in the script... (2 Replies)
Discussion started by: scottl
2 Replies
10. UNIX for Dummies Questions & Answers
I'm very new at this -- HELP!
I need to know how to terminate a users session when they exit a shell script menu?
Any ideas would be much appreciated!
Holli (2 Replies)
Discussion started by: HOlli
2 Replies
runat(1) User Commands runat(1)
NAME
runat - execute command in extended attribute name space
SYNOPSIS
/usr/bin/runat file [command]
DESCRIPTION
The runat utility is used to execute shell commands in a file's hidden attribute directory. Effectively, this utility changes the current
working directory to be the hidden attribute directory associated with the file argument and then executes the specified command in the
bourne shell (/bin/sh). If no command argument is provided, an interactive shell is spawned. The environment variable $SHELL defines the
shell to be spawned. If this variable is undefined, the default shell, /bin/sh, is used.
The file argument can be any file, including a directory, that can support extended attributes. It is not necessary that this file have any
attributes, or be prepared in any way, before invoking the runat command.
OPERANDS
The following operands are supported:
file Any file, including a directory, that can support extended attributes.
command The command to be executed in an attribute directory.
ERRORS
A non-zero exit status will be returned if runat cannot access the file argument, or the file argument does not support extended
attributes.
USAGE
See fsattr(5) for a detailed description of extended file attributes.
The process context created by the runat command has its current working directory set to the hidden directory containing the file's
extended attributes. The parent of this directory (the ".." entry) always refers to the file provided on the command line. As such, it may
not be a directory. Therefore, commands (such as pwd) that depend upon the parent entry being well-formed (that is, referring to a direc-
tory) may fail.
In the absence of the command argument, runat will spawn a new interactive shell with its current working directory set to be the provided
file's hidden attribute directory. Notice that some shells (such as zsh and tcsh) are not well behaved when the directory parent is not a
directory, as described above. These shells should not be used with runat.
EXAMPLES
Example 1: Using runat to list extended attributes on a file
example% runat file.1 ls -l
example% runat file.1 ls
Example 2: Creating extended attributes
example% runat file.2 cp /tmp/attrdata attr.1
example% runat file.2 cat /tmp/attrdata > attr.1
Example 3: Copying an attribute from one file to another
example% runat file.2 cat attr.1 | runat file.1 "cat > attr.1"
Example 4: Using runat to spawn an interactive shell
example% runat file.3 /bin/sh
This spawns a new shell in the attribute directory for file.3. Notice that the shell will not be able to determine what your current direc-
tory is. To leave the attribute directory, either exit the spawned shell or change directory (cd) using an absolute path.
Recommended methods for performing basic attribute operations:
display
runat file ls [options]
read
runat file cat attribute
create/modify
runat file cp absolute-file-path attribute
delete
runat file rm attribute
permission changes
runat file chmod mode attribute
runat file chgrp group attribute
runat file chown owner attribute
interactive shell
runat file /bin/sh
or set your $SHELL to /bin/sh and
runat file
The above list includes commands that are known to work with runat. While many other commands may work, there is no guarantee that any
beyond this list will work. Any command that relies on being able to determine its current working directory is likely to fail. Examples of
such commands follow:
Example 5: Using man in an attribute directory
example% runat file.1 man runat
getcwd: Not a directory
Example 6: Spawning a tcsh shell in an attribute directory
example% runat file.3 /usr/bin/tcsh
tcsh: Not a directory
tcsh: Trying to start from "/home/user"
A new tcsh shell has been spawned with the current working directory set to the user's home directory.
Example 7: Spawning a zsh shell in an attribute directory
example% runat file.3 /usr/bin/zsh
example%
While the command appears to have worked, zsh has actually just changed the current working directory to '/'. This can be seen by using
/bin/pwd:
example% /bin/pwd
/
ENVIRONMENT VARIABLES
SHELL Specifies the command shell to be invoked by runat.
EXIT STATUS
The following exit values are returned:
125 The attribute directory of the file referenced by the file argument cannot be accessed.
126 The exec of the provided command argument failed.
Otherwise, the exit status returned is the exit status of the shell invoked to execute the provided command.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO
open(2), attributes(5), fsattr(5)
NOTES
It is not always obvious why a command fails in runat when it is unable to determine the current working directory. The errors resulting
can be confusing and ambiguous (see the tcsh and zsh examples above).
SunOS 5.10 22 Jun 2001 runat(1)