0

I need to run an KSH script in VIO server remotely. But as VIO server is in restricted shell, I tried as below.

ssh -q -T padmin@vioserver  "oem_setup_env" < script.ksh

This was worked fine last time, But when try again today I found this throwing an error.

rksh: oem_setup_env:  not found

Can someone suggest how to run remotely on VIO servers.

Sriram P
  • 179
  • 1
  • 13
  • I have tried like `ssh -q -T padmin@vioserver "/usr/ios/cli/ioscli oem_setup_env"` now it throwing error as `rksh: /usr/ios/cli/ioscli: restricted` . **Is there any ways to make it work** – Sriram P Apr 11 '18 at 11:35

2 Answers2

1

I assume you are using keys so you can log in without using a password. If the previous sentence makes no sense to you, we can address that as well. Just ask.

VIOS is just AIX so it has a root user. You can find the path of root’s home with echo ~root. As I recall, it is usually /. So, become root by doing the oem_setup_env. Create ~root/.ssh. Copy your public key into ~root/.ssh/authorized_keys. Check all the permissions. They should be owned by root, and be either 0700 or 0600 permissions (not readable nor writable by others). Then use ssh root@host ...

pedz
  • 2,271
  • 1
  • 17
  • 20
  • No we are not using ssh keys, I have to login through padmin user then need switch to root through oem_setup_env. – Sriram P May 21 '18 at 11:47
  • I would suggest learn about ssh keys. It is very nice and secure. Then, as mentioned, add a key to root’s authorized file. – pedz May 26 '18 at 11:26
0

I tumbled upon this question when looking for a way to run commands as root through ssh. I found this to work:

ssh padmin@vioshost "echo lparstat -i | oem_setup_env"

lparstat could be substituted by and commands to be run as root.