[SOLVED] Issue in Providing Password in the bash file
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Iam trying to copy my file from one server to another in cpanel cron job.I am new in linux so i dont know much about it.So far i have added a cron job and it runs a .sh file.The code for this file is:-
Probably the better way would be to use rsync and let it worry about what's new and what's not. Either way, you need to be using keys for authentication. You can find a lot of tutorials on that, both good ones and bad ones, but mostly bad ones. Your choices at the moment for key types are RSA, ECDSA, and Ed25519. If you can, use Ed25519. If you have some weird backwards compatibility contraints, use RSA.
@Turbocapitalist,First Of All.Thanks for helping me out.But i have to use find as it is the requirement of a client,that only new files should be move.Otherwise I would've used automatic backup option of cpanel.And also problem with rsync is that whatever happens to the real file will also happen to the backup ones.So I've to use Find.
Second, I did a little research about it, and got to know about expect.The demo is:-
But it is still showing same error,I dont know that what is the main issue here,Can you help me with this please.Any Example will do.
Thanks
Best Regards
Ankit Rauthan
Last edited by AnkitRauthan; 10-23-2017 at 07:43 AM.
Where should the password go of username@hostname(target server).Or it is simply not required.
Thanks Mate,this was awesome.
Best Regards
Ankit Rauthan
Once the SSH key is on the remote server you do not need the password to login any more. In fact it is considered good practice to turn off password authentication for SSH in most cases.
Just remember that if you are automating this permanently that an agent needs to be running and that your script needs to point to the right agent using the SSH_AUTH_SOCK environment variable.
... an agent needs to be running and that your script needs to point to the right agent using the SSH_AUTH_SOCK environment variable.
My favorite way to accomplish that is with the keychain package. It's in the repository of most Linux distros.
Quote:
Keychain is a manager for OpenSSH, ssh.com, Sun SSH and GnuPG agents. It acts as a front-end to the agents, allowing you to easily have one long-running agent process per system, rather than per login session. This dramatically reduces the number of times you need to enter your passphrase from once per new login session to once every time your local machine is rebooted.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.