'Unable to run script remotely on VIO servers?

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.



Solution 1:[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 ...

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pedz
Solution 2 Seniorsamu