ssh in for loop and excute command as su
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
kamal@shell001:~ $ for i in `cat FILE`;do ssh $i -l localadmin 'su;ipmitool bmc reset cold';done
localadmin@server1's password:
Unknown command: su;ipmitool
Can someone please suggest how to execute ssh and switch to su
and run any command. Thanks you
I am using Debian 4.1.35-1 (debian-kernel@lists.debian.org).
sudo
doesn't work.
server1# su;ipmitool mc info
Unknown command: su;ipmitool
server1# su|ipmitool mc info
Unknown command: su|ipmitool
server1# su
root@server11:~#
Command after su with semicolon is not working. After switching as root, the command works.
debian
add a comment |Â
up vote
0
down vote
favorite
kamal@shell001:~ $ for i in `cat FILE`;do ssh $i -l localadmin 'su;ipmitool bmc reset cold';done
localadmin@server1's password:
Unknown command: su;ipmitool
Can someone please suggest how to execute ssh and switch to su
and run any command. Thanks you
I am using Debian 4.1.35-1 (debian-kernel@lists.debian.org).
sudo
doesn't work.
server1# su;ipmitool mc info
Unknown command: su;ipmitool
server1# su|ipmitool mc info
Unknown command: su|ipmitool
server1# su
root@server11:~#
Command after su with semicolon is not working. After switching as root, the command works.
debian
1) Please format your question and 2) did you trywhereis su
? and alsoman su
as you are not using it properly, but at the same time it is difficult to understand what you want to do. Are you mixingsu
withsudo
maybe?
â Patrick Mevzek
May 8 at 23:15
Add relevant information into the text of your question that you can edit, not as comments.
â Patrick Mevzek
May 8 at 23:20
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
kamal@shell001:~ $ for i in `cat FILE`;do ssh $i -l localadmin 'su;ipmitool bmc reset cold';done
localadmin@server1's password:
Unknown command: su;ipmitool
Can someone please suggest how to execute ssh and switch to su
and run any command. Thanks you
I am using Debian 4.1.35-1 (debian-kernel@lists.debian.org).
sudo
doesn't work.
server1# su;ipmitool mc info
Unknown command: su;ipmitool
server1# su|ipmitool mc info
Unknown command: su|ipmitool
server1# su
root@server11:~#
Command after su with semicolon is not working. After switching as root, the command works.
debian
kamal@shell001:~ $ for i in `cat FILE`;do ssh $i -l localadmin 'su;ipmitool bmc reset cold';done
localadmin@server1's password:
Unknown command: su;ipmitool
Can someone please suggest how to execute ssh and switch to su
and run any command. Thanks you
I am using Debian 4.1.35-1 (debian-kernel@lists.debian.org).
sudo
doesn't work.
server1# su;ipmitool mc info
Unknown command: su;ipmitool
server1# su|ipmitool mc info
Unknown command: su|ipmitool
server1# su
root@server11:~#
Command after su with semicolon is not working. After switching as root, the command works.
debian
edited May 9 at 7:28
GAD3R
22.1k154891
22.1k154891
asked May 8 at 23:05
Kamal Sahoo
32
32
1) Please format your question and 2) did you trywhereis su
? and alsoman su
as you are not using it properly, but at the same time it is difficult to understand what you want to do. Are you mixingsu
withsudo
maybe?
â Patrick Mevzek
May 8 at 23:15
Add relevant information into the text of your question that you can edit, not as comments.
â Patrick Mevzek
May 8 at 23:20
add a comment |Â
1) Please format your question and 2) did you trywhereis su
? and alsoman su
as you are not using it properly, but at the same time it is difficult to understand what you want to do. Are you mixingsu
withsudo
maybe?
â Patrick Mevzek
May 8 at 23:15
Add relevant information into the text of your question that you can edit, not as comments.
â Patrick Mevzek
May 8 at 23:20
1) Please format your question and 2) did you try
whereis su
? and also man su
as you are not using it properly, but at the same time it is difficult to understand what you want to do. Are you mixing su
with sudo
maybe?â Patrick Mevzek
May 8 at 23:15
1) Please format your question and 2) did you try
whereis su
? and also man su
as you are not using it properly, but at the same time it is difficult to understand what you want to do. Are you mixing su
with sudo
maybe?â Patrick Mevzek
May 8 at 23:15
Add relevant information into the text of your question that you can edit, not as comments.
â Patrick Mevzek
May 8 at 23:20
Add relevant information into the text of your question that you can edit, not as comments.
â Patrick Mevzek
May 8 at 23:20
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Shell operators only work in a shell.
ssh ... sh -c '...;...'
for i incat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.
â Kamal Sahoo
May 8 at 23:49
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Shell operators only work in a shell.
ssh ... sh -c '...;...'
for i incat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.
â Kamal Sahoo
May 8 at 23:49
add a comment |Â
up vote
1
down vote
accepted
Shell operators only work in a shell.
ssh ... sh -c '...;...'
for i incat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.
â Kamal Sahoo
May 8 at 23:49
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Shell operators only work in a shell.
ssh ... sh -c '...;...'
Shell operators only work in a shell.
ssh ... sh -c '...;...'
answered May 8 at 23:17
Ignacio Vazquez-Abrams
32k66780
32k66780
for i incat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.
â Kamal Sahoo
May 8 at 23:49
add a comment |Â
for i incat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.
â Kamal Sahoo
May 8 at 23:49
for i in
cat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.â Kamal Sahoo
May 8 at 23:49
for i in
cat FILE
;do ssh localadmin@$i "su -c 'ipmitool bmc reset cold'";done Thank you it's working.â Kamal Sahoo
May 8 at 23:49
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442649%2fssh-in-for-loop-and-excute-command-as-su%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1) Please format your question and 2) did you try
whereis su
? and alsoman su
as you are not using it properly, but at the same time it is difficult to understand what you want to do. Are you mixingsu
withsudo
maybe?â Patrick Mevzek
May 8 at 23:15
Add relevant information into the text of your question that you can edit, not as comments.
â Patrick Mevzek
May 8 at 23:20