Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Can I tell Rsync to wait longer for a password when connecting to a remote system?

  1. #1
    Join Date
    Mar 2008
    Beans
    244

    Can I tell Rsync to wait longer for a password when connecting to a remote system?

    I know this might not be specifically an Ubuntu question, it's more a bash shell or rsync question, but I'm really hoping someone can help.

    I have a shell script to backup my system and it uses rsync to first go to all three places and synchronize them with a central location, then the script uses Duplicity to back the central location (with all the newly refreshed files/folders), to another drive that's stored physically offsite.

    It works well but I have a problem in that if I don't happen to be sitting at the computer when it heads to a new system and requires password input, it times out, so that when I enter the password (after finally returning as seeing it needed it), instead of entering THAT system it just throws an error and moves to the NEXT system, skipping the one that was overlooked.

    Is there a way to tell Rsync to wait longer for a password (like a day?) before treating it as timed out?

    Thank you!

  2. #2
    currentshaft Guest

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    If you're using ssh as the rsync transport mechanism, you should be using public-key authentication instead of passwords.
    Last edited by coffeecat; September 3rd, 2024 at 11:38 AM. Reason: Original post content restored

  3. #3
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,565
    Distro
    Ubuntu Development Release

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    Wouldn't it be the login grace time for sshd? which can be set in /etc/ssh/sshd_config or via the command line:

    Code:
           -g login_grace_time
                   Gives the grace time for clients to authenticate themselves (default 120 seconds).  If the client fails to authenticate the user within this many seconds, the server disconnects and exits.  A value of zero indicates no limit.
    I didn't try it and I don't know if something else might timeout in the tcp connection state also.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  4. #4
    Join Date
    Feb 2019
    Location
    Virginia
    Beans
    393
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    I’m not sure what the point is of using a script to run a backup scheme where passwords are required. As mentioned, SSH Key based authentication without passwords would be the way to connect between hosts.

    If instead the password query is coming from trying to run an elevated rsync command, there is a way to configure an elevated user account to run only rsync, without a password. I tend to disable root login on my hosts and instead use a specific user account to run this single elevated command that I need for backing up. That command can be configured to run without a password over a key based SSH connection. I have several scripts that are launched by cron to do my pulls. I just have to make sure the computers are on, which they usually are.
    Last edited by aljames2; September 1st, 2024 at 09:40 PM. Reason: Typos

  5. #5
    Join Date
    Mar 2008
    Beans
    244

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    I'm afraid I'll need a little more help assuming anyone has the time, as the ssh-keygen seems to be taking me away from what I'm trying to do. 1) I am backing up several different users onto a system that doesn't include those users. So I ran into issues using ssh-keygen because most of the instructions seem to assume you're backing up "userX" on one system to "userX" on the remote one. In this case I'm backing up "userX, userY, userZ" to a folder on UserB's system, then backing up UserB.

    When I tried making a key for UserX, UserY, and UserZ I got an error that a key already exists. So maybe that's the most elegant way to accomplish this but it seems to veer me into a different thing.

    I know there may be other ways to do this but to be honest, the easiest seemed to be just giving me a bit more time to enter the password, which was my question. Would anyone know if this is possible?

  6. #6
    Join Date
    Feb 2019
    Location
    Virginia
    Beans
    393
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    If your method has been working as you need, except for this password timing issue, did you investigate/try the suggestion provided by @Doug S

  7. #7
    Join Date
    Mar 2008
    Beans
    244

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    Quote Originally Posted by aljames2 View Post
    If your method has been working as you need, except for this password timing issue, did you investigate/try the suggestion provided by @Doug S
    Thank you, no, somehow I skipped over that and hadn't seen it. I don't know if it's an ssh or an rsync issue. Is this something I set on my side or does it need to be set in each of the locations as well?

  8. #8
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    the easiest seemed to be just giving me a bit more time to enter the password, which was my question. Would anyone know if this is possible?

    If time (or other condition) is what you want then a simple use of Actiona a UI emulator will paste in a variable such as password at a given date/time - like cron but with widgets.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    There are timeout periods for all tcp connections set in the kernel. Trying to keep connections open too long will eat resources and eventually, no new network connections will be possible. There have been tcp attacks abusing this part of the tcp protocol, so most systems are setup with less than 3 minutes before a connection timeout happens.

    Probably just best to run the rsync when you are there or leaving the system and can enter the password, if you aren't willing to setup ssh-keys. Using ssh-keys is the normal solution method. It is 2 commands. ssh-keygen and ssh-copy-id. Normally, backups need to be performed as root to maintain the correct timestamps and permissions.

  10. #10
    Join Date
    Mar 2008
    Beans
    244

    Re: Can I tell Rsync to wait longer for a password when connecting to a remote system

    Thank you all for the info. I've tried to adjust the timeout variable (both on my local and remote machines) and it doesn't seem to work. Do I need to source the config after adjusting that variable?

    I appreciate the suggestions. Probably will try the ssh-keygen method if I can't get more time from the login timeout. Seems very complicated, though.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •