![]() ![]() This entry was posted in Tips and tagged auth, rsync, ssh, sudo by dg12158. Yes, you could enable remote root login, but it would definitely be preferable to avoid that. Hooray, this works! Bit of a faff but it could be scripted or made into a shell function to save having to remember it □ # rsync -av -e 'ssh -X' -rsync-path='SUDO_ASKPASS=/usr/libexec/openssh/ssh-askpass sudo -A rsync' /some/local/path password: Again sudo won’t have a tty to ask for the password on, so how about we use an X11 askpass program and enable X forwarding for ssh: 1354561782 2/1: 1 sudo: no tty present and no askpass program specified. We’ll use /usr/libexec/openssh/ssh-askpass as that should pick an appropriate version according to what is available to sudo. 1354561775 1/5: 1 user1 is not in the sudoers file. We can find this with locate askpass on the remote locate askpass Fortunately there is a -A option for sudo which tells it to use an “askpass” program, but we also need to tell it what askpass program to use (and it’s not in the default path on most machines). So we need to tell sudo to ask for the password some other way. # rsync -av -e 'ssh -t' -rsync-path='sudo rsync' /some/local/path will not be allocated because stdin is not a password: As it can’t find a tty, sudo fall back to an askpass method but can’t find an askpass command configured. Adding the -t option to the ssh used by rsync doesn’t work either, as it can’t allocate a tty: The error message sudo: no tty present and no askpass program specified will occur when the sudo command is trying to execute a command that requires a password but sudo does not have access to a tty to prompt the user for a passphrase. ![]() Oh, that didn’t work - sudo couldn’t ask us for a password. Rsync error: error in rsync protocol data stream (code 12) at io.c(632) Rsync: connection unexpectedly closed (0 bytes received so far) Sudo: no tty present and no askpass program specified # rsync -av -e 'ssh' -rsync-path='sudo rsync' /some/local/path password: # rsync -av -e 'ssh' /some/local/path works fine and prompts for the ssh password to log into the remote machine if required.īut what if the remote end needs root (or a different user) rights to write into the destination directory? Just whack in an -rsync-path option to add sudo to the rsync command, right?: If you want passwordless login up to the root account (which is generally not a good idea from a security perspective), use SSH to reach the root account, preferably in two hops.Using rsync normally is nice and straightforward. If you installed your gitlab runner from the official apt repositories then your gitlab-runner process will run under the gitlab-runner user. And add your gitlab runner user to the bottom. Note that you still need to have a terminal, even with NOPASSWD, if the requiretty option is set in the sudoers file. Open up the sudoers file for editing in your favorite editor. Sudo requires a password (unless you add the NOPASSWD tag in the sudoers file). If you expected the SSH passphrase to replace your password for authentication to sudo, that's not going to happen. If that's the problem, run ssh inside a terminal emulator such as Console2 or Mintty (included in the Cygwin distribution) - see Best way to use a shell with Cygwin in Windows 7. The Windows console does not completely emulate a unix terminal there may be some difficulty for Cygwin applications to properly emulate a terminal in these circumstances (I'm not sure about that, note). If you aren't able to enter the password even with -t, it's possible that your problem is due to Windows. See SSH inside SSH fails with "stdin: is not a tty" for a more detailed explanation. If you pass a command to ssh, it assumes that the command doesn't need a terminal and doesn't create one, unless you pass -t. You need to have a terminal available to run sudo so that it can prompt you for the password. I did: sudo usermod -a -G dialout zabbix So modbus. update, i tried again the modbus.get e now a got this. Sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified Ty Hamardaban i appreciate your tips. Unfortunately, every time I run ssh 'sudo /var/I have also tried to add -t -t but then it prompts me for the password. Since options 2 and 3 require a TTY (sudo wont read from a pipe) it wont run if it cant. the user entered the correct source password. the user entered the correct target password. I then also tried to add 'newton ALL=NOPASSWD: /var/www/script.sh' sudo will only run a program as a different user if one of these 3 conditions has been met (as far as passwords are concerned): the NOPASSWD option is specified. I have setup SSH keys so when I run 'ssh it automatically logs me in, I have also set this user in visudo to be 'newton ALL=(ALL:ALL) ALL' I keep getting this error and have tried several ways discussed online to fix this and none are working for me. hafcClient client. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |