Sponsored Content
Full Discussion: Change user
Top Forums Shell Programming and Scripting Change user Post 302414937 by abdujaparov on Thursday 22nd of April 2010 04:58:17 AM
Old 04-22-2010
Change user

Hi,
I have to change many times user in a script.
With the command su userName I receive the request for password. I need to open a session with another user I would put the password at the beginning.
How can I do it?
Thanks, bye bye.

---------- Post updated 22-04-10 at 10:58 AM ---------- Previous update was 21-04-10 at 04:41 PM ----------

Hi,
I tried this command:

Code:
VAR=$(expect -c "
spawn su - $USER 
expect \"password:\"
send \"$PWD\r\"
expect \"\\\\$\"
send \"ls >pippo2204.txt\r\"
expect -re \"$USER.*\"
send \"logout\"
")

In this way I am able to change user and execute the ls command.
No I have a problem

I have to execute, changing user this code:


Code:
operation1

operation2



ssh $HOST<<END

operation3

END

Where operation are sqlplus session. I need to execute the code I past as userA while other code, after what I past need to be executed as userB.

How can I open a session for the code I past as userA and close the session after operations are completed?
Thanks, bye bye.
 

8 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

User name change?

Hello, I love the service. My username is Jmt. Can I change that to WebKruncher? Thanks, -Jmt WebKruncher.com - sole proprietor. (1 Reply)
Discussion started by: Jmt
1 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Change of user name

I am on several other Forums under the handle of FloridaBD and therefore would like to request that my user name here on Unix forums be changed from SunBurntYux to FloridaBSD Thanks. (1 Reply)
Discussion started by: SunBurntYux
1 Replies

3. Shell Programming and Scripting

How do i change to super user then revert back to ordinary user ,using shell script?

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

4. UNIX for Dummies Questions & Answers

change user> to user@host> ssh prompt

Hi, I was wondering how to change the prompt for my ssh login. At the moment it is like user> while I'd like it to be as user@host> It is in the .bash_profile or .ssh ??? Thanks (2 Replies)
Discussion started by: pmasterkim
2 Replies

5. Solaris

how to change /export/home/user dir to /home /user in solaris

Hi all i am using solaris 10, i am creating user with useradd -d/home/user -m -s /bin/sh user user is created with in the following path /export/home/user (auto mount) i need the user to be created like this (/home as default home directory ) useradd -d /home/user -m -s /bin/sh... (2 Replies)
Discussion started by: kalyankalyan
2 Replies

6. Red Hat

Change user from SH TO CSH

Dear Experts, I'm currently working on a Red Hat Linux env. I have been working in AIX. My user is set to use SH default so when it logs in, we have to manually csh to do few things. I know you can change this in AIX using smitty tool. is there any similar too in LINUX that can change it? ... (7 Replies)
Discussion started by: Afi_Linux
7 Replies

7. AIX

How to change normal user id to LDAP user id?

If I create a new user id test: mkuser id=400 test then I want it to LDAP user: chuser -R LDAP SYSTEM=LDAP registry=LDAP test It shows: 3004-687 User "test" does not exist. How to do? (4 Replies)
Discussion started by: rainbow_bean
4 Replies

8. Shell Programming and Scripting

Change user

Hi All, need your assistance, how can i change user again after i change my user. here is the code that i tried su - myuser #success su - webuser ##what i want to try is to change user again to webuser from myuser account my output is it cannot change to webuser account. only in... (8 Replies)
Discussion started by: meister29
8 Replies
imqusermgr(1M)						  System Administration Commands					    imqusermgr(1M)

NAME
imqusermgr - command utility for managing a Message Queue user repository SYNOPSIS
/usr/bin/imqusermgr subcommand [[option]...] /usr/bin/imqusermgr -h /usr/bin/imqusermgr -v DESCRIPTION
The imqusermgr utility manages a file-based user repository to authenticate and authorize users of a Message Queue message server. imqusermgr provides subcommands for adding, deleting, updating, and listing user entries in the repository. imqusermgr supports four management subcommands. These subcommands, and their corresponding options follow the imqusermgr command on the command line. See USAGE and OPTIONS. The following subcommands are supported: add Add a new user and associated password to the repository. delete Delete a user from the repository. list Display information users in the repository. update Update the password or state of a user in the repository. OPTIONS
The following options are supported: -a active_state Specify if user's state is active or inactive. An inactive user cannot create connections to the Message Queue message server. Valid values for active_state are true or false. Specify true for active or false for inactive. the default is true. Use this option with the update subcommmand. -f Perform action without user confirmation. Use this option with the delete and update subcommmands. -g group Specify the group of the user. Valid values for group are admin, user, and anonymous. Use this option with the add subcommmand. -h Display usage help. Exceute nothing else on the command line. -i brokerName Specify the broker instance user repository to which the command applied. If you do not specify brokerName, the default brokerName is assumed. Use this option with the add, delete, list, and update subcommmands. -p password Specify user password. Use this option with the add and update subcommmands. -s Silent mode. Display no output Use this option with the add, delete, and update subcommands. -u userName Specify user name. userName cannot contain the following characters: asterisk (*), colon (:), <NEWLINE>, or <RETURN>. Use this option with the add, delete, update and list subcommands. -v Display version information. Exceute nothing else on the command line. USAGE
The following subcommands and corresponding options are supported: add -u userName -p password [-g group] [-s] [-i brokerName] Add a new user and associated password to the repository, and optionally specify the user's group. delete -u userName [-s] [-f] [-i brokerName] Delete a user from the repository. list [-u user_name] [-i brokerName] Display information about the specified user in the repository. If no user is specified, all users are displayed. update -u userName -p password [-a state] [-s] [-f] [-i brokerName] update -u userName -a state [-p password] [-s] [-f] [-i brokerName] Update the password or state (or both) of a user. ENVIRONMENT VARIABLES
The following environment variables affect the execution of this command: IMQ_JAVAHOME Specify the Java 2 compatible runtime. When this environment variable is not set, it defaults to /usr/j2se. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/etc/imq/passwd Flat-file user repository. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWiqu | +-----------------------------+-----------------------------+ SEE ALSO
imqadmin(1M), imqbrokerd(1M), imqcmd(1M), imqdbmgr(1M), imqkeytool(1M), imqobjmgr(1M), attributes(5) Sun Java System Message Queue Administrator's Guide SunOS 5.10 23 Mar 2004 imqusermgr(1M)
All times are GMT -4. The time now is 10:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy