I need to run script on remote server which require root access using sshpass and its failing
0
votes
1
answer
95
views
I need to run script on remote server which require root access using sshpass and its failing with eror script not found. I ran below command.
sshpass -frhelpass ssh user@IP 'echo mypass | sudo -S "bash -s" < "./pv.sh"'
Authorized uses only. All activity may be monitored and reported.
bash: pv.ksh: No such file or directory
If I copy script remotely ( I can copy script) but execution is failing.
sshpass -frhelpass ssh user@IP 'echo mypass | sudo -Sv && 'bash -s' < /tmp/pv.sh'
Authorized uses only. All activity may be monitored and reported.
[sudo] password for user: _
WARNING: Running as a non-root user. Functionality may be unavailable.
/run/lock/lvm/P_global:aux: open failed: Permission denied
I am running these commands from ubuntu command line
Asked by user29368204
(1 rep)
Jan 26, 2025, 03:31 AM
Last activity: Jan 27, 2025, 08:29 AM
Last activity: Jan 27, 2025, 08:29 AM