Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
su
- Page 1
Re: su - postgres within shell script
Programming
Software Development
17 Years Ago
by eggi
…'s probably expecting a reply to the password: prompt from
su
. You can make it all one line and get away… enter 3 passwords (assuming you're not
su
-ing postgres as root) - one for the
su
- one for the createuser and one… for the createdb call)
su
- postgres -c "echo "Please enter the password for …
Re: su - postgres within shell script
Programming
Software Development
17 Years Ago
by masijade
Because
su
opens an interactive shell you might try placing everything below the
su
command into a seperate script (lets imagine we call it newScript.ksh), then change this script to the following: [code] #!/bin/sh
su
- postgres -c "/path/to/newScript.ksh" [/code]
Re: su - postgres within shell script
Programming
Software Development
17 Years Ago
by masijade
… always forego maintaining a separate file, and still execute
su
on a single command as follows: [code] #!/bin…d -r -e a2billinguser createdb -e -O a2billinguser a2billing EOF
su
- postgres -c "/tmp/someObscureName.sh" rm -f… providing alot of semicolon separated commands into a single
su
-c. It is cleaner and easier to understand…
su - postgres within shell script
Programming
Software Development
17 Years Ago
by toronto
… am learning quickly. My script looks as follows: #!/bin/sh
su
- postgres echo "Please enter the password for a2billing user… create database. However, my output stops after using command "
su
- postgres". What can I do to curb this? is…
Re: su - postgres within shell script
Programming
Software Development
14 Years Ago
by sahosri
… in a condition the script will change the user like
su
- xxx and then it has to execute some commands/scripts… session and should return to script. I have tried using
su
- xxx -c but it terminates the session after executing the…
How to su properly in a shell script
Programming
Software Development
20 Years Ago
by stharmon
… the program properly. Whenever I do the shell script
su
's to the user properly but the scripts stops executing… -R vpopmail:vchkpw ../courier-imap-2.2.2.20040207 [B]
su
- vpopmail[/B] ./configure --with-redhat I have also tried … to stay in the same shell and preserve the environment:
su
- -m -p vpopmail Does anyone have any thought as…
Re: How to su properly in a shell script
Programming
Software Development
16 Years Ago
by Fest3er
… -R vpopmail:vchkpw ../courier-imap-2.2.2.20040207 [B]
su
- vpopmail[/B] ./configure --with-redhat [/code] ... Does anyone …have any thought as to how I can successfully
SU
and keep the script running?[/QUOTE] To actually answer… to feed the commands you want to execute to
su
(), as in:[code]
su
-c "./configure --with-redhat" - …
Re: How to su properly in a shell script
Programming
Software Development
14 Years Ago
by komalar
Is it possible for me to
su
to different user from within a script, execute few commands … stay in the same shell...? For Ex: #!/bin/sh sudo
su
- user1 echo #HOME echo `ls -ltr` This should print the… same shell. But the script doesn't execute after
su
to user1. sudo
su
- c "echo $HOME" - user1 works but…
sudo su - user in a shell script
Programming
Software Development
14 Years Ago
by enthu_Unix
…scripting. Okay, the requirement is user1 has sudo rule to
su
- user2(NO PASSWORD) and user2 has will be able… so following works fine from command prompt user1@host] sudo
su
- user2 the above command opens up a new shell,… have tried putting following commands in a shell script sudo
su
- user2 -c "sudo cmd1" (this prompts …
Re: Block User but allow su -
Community Center
17 Years Ago
by ajcamp
Hi, That will lock the initial login, and also prevent
su
- <user> from working as well. To enable
su
- <user> I had to give the users sudo access, and prevent
su
to root: ALL ALL=(ALL) NOPASSWD: /bin/
su
- <user> , ! /bin/
su
*root* Andrew
Re: How to su properly in a shell script
Programming
Software Development
14 Years Ago
by Peter Odéus
I am executing the following script like "sudo ./script.sh", so that no authorization is needed when temporarily switching to user "test". The HERE tags delimit the execution in the test user context [code] #!/bin/sh echo ~/
su
- test <<HERE echo ~/ ls -al HERE echo ~/ [/code] :-) /Peter Odéus
Passing a variable with a password to the SU command
Programming
Software Development
20 Years Ago
by stharmon
…to log in as root" echo "*************************************************************"
su
-c "ACME_QUIET=y rpm -ivh /home/acmeUser/acme_install…to log in as root." echo "**************************************************************************"
su
-c "rpm -ivh /home/acmeUser/acme_install/components/acme…
Re: Passing a variable with a password to the SU command
Programming
Software Development
20 Years Ago
by HawkeVIPER
…to log in as root" echo "*************************************************************"
su
-c "ACME_QUIET=y rpm -ivh /home/acmeUser/acme_install…to log in as root." echo "**************************************************************************"
su
-c "rpm -ivh /home/acmeUser/acme_install/components/acme…
Re: Passing a variable with a password to the SU command
Programming
Software Development
20 Years Ago
by stharmon
…, is how you were able to pass the password to
SU
with multiple commands (using ; )? So how'd you do it… wasn't able to "pass" the password to
SU
. Instead, I combined the commands into one (using ;). That way… you ever find out how to pass the password to
SU
, I would like to know as well...
Re: Passing a variable with a password to the SU command
Programming
Software Development
20 Years Ago
by Comatose
I understand what ; does on a command prompt and what not. What I DON'T understand, is how you were able to pass the password to
SU
with multiple commands (using ; )? So how'd you do it?
Block User but allow su -
Community Center
17 Years Ago
by ajcamp
Anyone know how to block a user from TTY login, thus forcing them to use their personal login, BUT then allowing them to
su
- to the blocked account? Changing shell to /sbin/nologin/ also blocks
su
- access. Do I need to use PAM to do this? Ugh. Thanks AJ
Re: su - postgres within shell script
Programming
Software Development
17 Years Ago
by toronto
Thanks you very much Masijade and Eggi. I tried both methods and find the one line easier because of not creating another file; however, I understand that as the file gets bigger then it's better to have it chunks (more organized). You guys are AMAZING. THANKS
Re: su - postgres within shell script
Programming
Software Development
14 Years Ago
by masijade
Have the last command be a call to a shell. You [i]do[/i] know, however, that this is rendering your security a moot point, right? [i]Not[/i] a good idea IMHO.
Re: How to su properly in a shell script
Programming
Software Development
20 Years Ago
by alc6379
Ever thought about [b][url=http://www.courtesan.com/sudo/man/sudo.html]sudo[/b][/url]? It will allow you to execute single commands as a user without having to drop into the shell of that user. You could even run [b]sudo[/b], and point it to another shell script that contains all of the commands you need it to run, so you could make that script…
Re: How to su properly in a shell script
Programming
Software Development
16 Years Ago
by akku12345
[QUOTE=alc6379;72307]Ever thought about [b][url=http://www.courtesan.com/sudo/man/sudo.html]sudo[/b][/url]? It will allow you to execute single commands as a user without having to drop into the shell of that user. You could even run [b]sudo[/b], and point it to another shell script that contains all of the commands you need it to run, so you …
Re: How to su properly in a shell script
Programming
Software Development
14 Years Ago
by rehm
hi i need automated routines in bash shell.. i do know how i m start, if you know pls send it to me....
Re: How to su properly in a shell script
Programming
Software Development
14 Years Ago
by rehm
hi i need automated routines in bash shell.. i don't know how i m start, if you know pls send it to me....
Re: sudo su - user in a shell script
Programming
Software Development
14 Years Ago
by rch1231
Hello, SUDO is to make you have root privileges for executing the script you are about to run not really used for switching to a different user. There are other options. Linux allows you to set up a script so that when it is run it appears to be run by the owner of the file. You will see these in various place throughout the file structure. As…
Re: sudo su - user in a shell script
Programming
Software Development
14 Years Ago
by cfajohnson
Use: sudo -U user <command or script>
Re: Passing a variable with a password to the SU command
Programming
Software Development
20 Years Ago
by YUPAPA
[QUOTE=stharmon]Another option would be to use SUDO (so people tell me),[/QUOTE] That was what I was going to suggest :cheesy: You can pass the password using a pipe I guess ~ :-| I know how to do this in perl, but not in bash at the moment ~
Re: Passing a variable with a password to the SU command
Programming
Software Development
20 Years Ago
by stharmon
It looks like I was able to use ; to separate the commands and it worked just fine. I had problems using & Thanks for the help!
Re: Block User but allow su -
Community Center
17 Years Ago
by Toba
passwd -l username passwd -u username to unlock again man passwd for more details.
Re: merging text files on column
Programming
Software Development
14 Years Ago
by woooee
…163743', 'BML-257 BML-257 Tanimoto from
SU
= 0.156627', '
SU
4312
SU
4312 Tanimoto from
SU
= 1', 'AG-370 AG-370 Tanimoto…163743', 'BML-257 BML-257 Tanimoto from
SU
= 0.156627', '
SU
4312
SU
4312 Tanimoto from
SU
= 1', 'AG-370 AG-370 …163743', 'BML-257 BML-257 Tanimoto from
SU
= 0.156627', '
SU
4312
SU
4312 Tanimoto from
SU
= 1', 'AG-370 AG-370 …
python program with italian explanation ,
Programming
Software Development
17 Years Ago
by ThePATRIOT
…): #Ciclo infinito s=GPIO.setIOvalue(6,1) #Accendo il led
su
GPIO6 if(GPIO.getIOvalue(4)==0): #Verifico lo stato del… port GPIO4 s=GPIO.setIOvalue(5,1) #Accendo il led
su
GPIO5 TXbuff="AT+CMGS=\"%s\"\r"… un secondo s=GPIO.setIOvalue(6,0) #Spengo il led
su
GPIO6 MOD.sleep(10) #Pausa per un secondo else: #…
Re: python program with italian explanation ,
Programming
Software Development
17 Years Ago
by demetrio
… s=GPIO.setIOvalue(5,1) #Accendo il led
su
GPIO5 En- It turns on the LED on GPIO5…GPIO6 s=GPIO.setIOvalue(7,0) #Spengo il led
su
GPIO7 En- It turns off the LED on GPIO7 …loop s=GPIO.setIOvalue(6,1) #Accendo il led
su
GPIO6 En- It turns on the LED on GPIO6 …port s=GPIO.setIOvalue(5,1) #Accendo il led
su
GPIO5 En- It turns on the LED on GPIO5…
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC