So I'm creating a backup GUI in Python which basically asks the user for their username/password and source directory so it can be rsynced over to a remote server. The only trouble I'm coming across is passing the password (entered in the GUI) to the server after I execute the command :

rsync -options source_path rsync_user@rsync_server:remote_path

Since I want the user to authenticate everytime they use the GUI I don't want to setup an automated ssh key session. I looked a bit into Pexpect and Paramiko but expect doesn't seem very secure and I wasn't sure how to configure Paramiko so I could rsync from the local computer to the remote server.

Basically I'm looking for a way to pass a password to the server (and trust the host) after the rsync command without any sort of terminal interaction (the purpose of the GUI).

Recommended Answers

All 2 Replies

You would first have to encrypt the password, using whatever method your OS uses and then pass the encrypted password (unless it will be encrypted somewhere along the line), as only the very, very foolish store unencrypted passwords.

From the rsync man page
"Some paths on the remote server may require authentication.
If so then you will receive a password prompt when you connect.
You can avoid the password prompt by setting the environment variable
RSYNC_PASSWORD to the password you want to use or using the --password-file option.
This may be useful when scripting rsync."

There is also Grsync, but I have not used it.

You would first have to encrypt the password, using whatever method your OS uses and then pass the encrypted password (unless it will be encrypted somewhere along the line), as only the very, very foolish store unencrypted passwords.

From the rsync man page
"Some paths on the remote server may require authentication.
If so then you will receive a password prompt when you connect.
You can avoid the password prompt by setting the environment variable
RSYNC_PASSWORD to the password you want to use or using the --password-file option.
This may be useful when scripting rsync."

There is also Grsync, but I have not used it.

Yeah I've looked into the password-file option but I believe that it doesn't work for rsyncing via SSH but only through daemon.

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.