Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: OpenSSH and multiple users

by NetWallah (Canon)
on Jan 04, 2016 at 22:20 UTC ( [id://1151896]=note: print w/replies, xml ) Need Help??


in reply to Re^2: OpenSSH and multiple users
in thread OpenSSH and multiple users

If you need to run a single command (as in your post), you can remove the separate "su" line, and try:
$ssh->system("su -c 'show status' admin");
Of course, you will need to remove the corresponding "exit", because this will run the command, and exit automatically.

        "I can cast out either one of your demons, but not both of them." -- the XORcist

Replies are listed 'Best First'.
Re^4: OpenSSH and multiple users
by judgemstr (Novice) on Jan 04, 2016 at 22:46 UTC
    That got me a little bit closer but now I get this error.
    [172.16.100.27] su -c 'show status' admin Jan 4 14:16:30 <auth.err> 42 su: login_getclass: unknown class 'show +status' Remote Console Remote Console Press return for console:
      Hmmm . FreeBSD "su" interprets the "-c" option as "class". , so it is useless for your purpose.

      I dont see any good options. It looks like you will have to install "sudo" if it is not already installed on the target system.

      For instructions on sudo install see What's the sudo equivalent for FreeBSD?.

              "I can cast out either one of your demons, but not both of them." -- the XORcist

        FreeBSD "su" interprets the "-c" option as "class".

        Explicitly invoking sh should do the trick: su admin sh -c 'show status'

        Reading the fine manual suggests that the problem of "-c" could also be the order of arguments: su -c 'show status' admin has "-c" in front of the login parameter. Moving "-c" after the login parameter, as shown in the third example, should work: su admin -c 'show status'.

        Please note: everything posted here is untested, I currently have no FreeBSD machine to test.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1151896]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2024-04-23 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found