Normally, it would be sufficient to just use ssh directly, for one-off implementation.
One-Off Operation
as long as yesh is super-user and you know the password for yesh, you can do the following to update over ssh.
ssh as yesh (assumes you have the password).
ssh [email protected]
Change to make script executable
Ubuntu> sudo chmod 755 /home/yesh/yesh_final_V1.sh
Scripted Operation
The author of the question commented that they wish to do this in scripted form. To achieve this, you can use the "sshpass" functionality, which has to be present on the host computer.
sudo apt-get install sshpass
To use it, you may find the below bash script example useful:
function scripted_remote_operation {
sshpass -f password.txt ssh -o StrictHostKeyChecking=no -t -t [email protected] -o StrictHostKeyChecking=no <<EOF
sudo chmod 755 /home/yesh/yesh_final_V1.sh
exit
EOF
}
This can be executed from the host computer as part of a script, automatically logging in, making the change as requested. Unfortunately, this will require that the password requirement for users with admin privileges, be disabled (NOT RECOMMENDED).
For example, in the directory
/etc/sudoers.d
You could include the file
010_ubuntu-nopasswd
with the contents
root ALL=(ALL) NOPASSWD: ALL
This information is provided for clarity only. It is absolutely not a good idea to disable the sudo password on a machine.
Possible Answer Without sudo on the remote machine
If the file is installed remotely with yesh as the owner, then the chmod operation can happen without elevated privileges, and the chown operation can be included in the same sshpass script.