I am trying to create a script that does 2 things. I imagine this can be done in 2 or 3 lines.

1. ssh to a server
2. execute the passwd command

here is what I am trying -

ssh -l username server

Once the script ssh's to the server, it tries to chdir to my home directory. I have no home directory on the server, only ssh access, so it gives the error - Could not chdir to home directory : No such file or directory.

The script stops there and does not execute the passwd command. If I type "passwd", it successfully executes.

Can anyone help me figure out how to do this?

Thank you.


try adding \. at the end to take you to the root directory.

Thanks for the reply. No dice, though. It does the exact same thing.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.