How is rsync able to work with ssh, when ssh reads and writes output of its own?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
$ SSH_AUTH_SOCK= rsync x brick:
Enter passphrase for key '/home/alan/.ssh/id_rsa':
alan@brick.carrier.duckdns.org: Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.3]
rsync supports arbitrary remote shells with --rsh
. How is the rsh, e.g. ssh
, able to write messages, and not have them mis-interpreted as coming from the rsync process on the server?
rsync
add a comment |Â
up vote
0
down vote
favorite
$ SSH_AUTH_SOCK= rsync x brick:
Enter passphrase for key '/home/alan/.ssh/id_rsa':
alan@brick.carrier.duckdns.org: Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.3]
rsync supports arbitrary remote shells with --rsh
. How is the rsh, e.g. ssh
, able to write messages, and not have them mis-interpreted as coming from the rsync process on the server?
rsync
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
$ SSH_AUTH_SOCK= rsync x brick:
Enter passphrase for key '/home/alan/.ssh/id_rsa':
alan@brick.carrier.duckdns.org: Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.3]
rsync supports arbitrary remote shells with --rsh
. How is the rsh, e.g. ssh
, able to write messages, and not have them mis-interpreted as coming from the rsync process on the server?
rsync
$ SSH_AUTH_SOCK= rsync x brick:
Enter passphrase for key '/home/alan/.ssh/id_rsa':
alan@brick.carrier.duckdns.org: Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.3]
rsync supports arbitrary remote shells with --rsh
. How is the rsh, e.g. ssh
, able to write messages, and not have them mis-interpreted as coming from the rsync process on the server?
rsync
rsync
asked Aug 8 at 11:48
sourcejedi
19.9k42683
19.9k42683
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
SSH is prompting and reading the login secrets through a separate file descriptor; it makes sure to open the current TTY.
Most programs take care to read login secrets from a TTY, so that they can stop the password from being shown by temporarily disabling the "echo" on the TTY. I would expect them to make sure to write the prompt to the same TTY, for robustness sake.
$ SSH_AUTH_SOCK= strace -f rsync x brick:
...
[pid 26255] openat(AT_FDCWD, "/dev/tty", O_RDWR) = 4
[pid 26255] ioctl(4, TCGETS, B38400 opost isig icanon echo ...) = 0
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon -echo ...) = 0
...
[pid 26255] write(4, "Enter passphrase for key '/home/"..., 51Enter passphrase for key '/home/alan/.ssh/id_rsa': ) = 51
[pid 26255] read(4, "", 1) = 0
[pid 26255] write(4, "n", 1
) = 1
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon echo ...) = 0
...
SSH printed the error message to standard error (open file number 2), not standard output (open file number 1) which rsync would use for its protocol.
[pid 26255] write(2, "alan@brick.carrier.duckdns.org: "..., 64alan@brick.carrier.duckdns.org: Permission denied (publickey).
) = 64
[pid 26255] exit_group(255) = ?
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
SSH is prompting and reading the login secrets through a separate file descriptor; it makes sure to open the current TTY.
Most programs take care to read login secrets from a TTY, so that they can stop the password from being shown by temporarily disabling the "echo" on the TTY. I would expect them to make sure to write the prompt to the same TTY, for robustness sake.
$ SSH_AUTH_SOCK= strace -f rsync x brick:
...
[pid 26255] openat(AT_FDCWD, "/dev/tty", O_RDWR) = 4
[pid 26255] ioctl(4, TCGETS, B38400 opost isig icanon echo ...) = 0
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon -echo ...) = 0
...
[pid 26255] write(4, "Enter passphrase for key '/home/"..., 51Enter passphrase for key '/home/alan/.ssh/id_rsa': ) = 51
[pid 26255] read(4, "", 1) = 0
[pid 26255] write(4, "n", 1
) = 1
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon echo ...) = 0
...
SSH printed the error message to standard error (open file number 2), not standard output (open file number 1) which rsync would use for its protocol.
[pid 26255] write(2, "alan@brick.carrier.duckdns.org: "..., 64alan@brick.carrier.duckdns.org: Permission denied (publickey).
) = 64
[pid 26255] exit_group(255) = ?
add a comment |Â
up vote
0
down vote
accepted
SSH is prompting and reading the login secrets through a separate file descriptor; it makes sure to open the current TTY.
Most programs take care to read login secrets from a TTY, so that they can stop the password from being shown by temporarily disabling the "echo" on the TTY. I would expect them to make sure to write the prompt to the same TTY, for robustness sake.
$ SSH_AUTH_SOCK= strace -f rsync x brick:
...
[pid 26255] openat(AT_FDCWD, "/dev/tty", O_RDWR) = 4
[pid 26255] ioctl(4, TCGETS, B38400 opost isig icanon echo ...) = 0
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon -echo ...) = 0
...
[pid 26255] write(4, "Enter passphrase for key '/home/"..., 51Enter passphrase for key '/home/alan/.ssh/id_rsa': ) = 51
[pid 26255] read(4, "", 1) = 0
[pid 26255] write(4, "n", 1
) = 1
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon echo ...) = 0
...
SSH printed the error message to standard error (open file number 2), not standard output (open file number 1) which rsync would use for its protocol.
[pid 26255] write(2, "alan@brick.carrier.duckdns.org: "..., 64alan@brick.carrier.duckdns.org: Permission denied (publickey).
) = 64
[pid 26255] exit_group(255) = ?
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
SSH is prompting and reading the login secrets through a separate file descriptor; it makes sure to open the current TTY.
Most programs take care to read login secrets from a TTY, so that they can stop the password from being shown by temporarily disabling the "echo" on the TTY. I would expect them to make sure to write the prompt to the same TTY, for robustness sake.
$ SSH_AUTH_SOCK= strace -f rsync x brick:
...
[pid 26255] openat(AT_FDCWD, "/dev/tty", O_RDWR) = 4
[pid 26255] ioctl(4, TCGETS, B38400 opost isig icanon echo ...) = 0
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon -echo ...) = 0
...
[pid 26255] write(4, "Enter passphrase for key '/home/"..., 51Enter passphrase for key '/home/alan/.ssh/id_rsa': ) = 51
[pid 26255] read(4, "", 1) = 0
[pid 26255] write(4, "n", 1
) = 1
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon echo ...) = 0
...
SSH printed the error message to standard error (open file number 2), not standard output (open file number 1) which rsync would use for its protocol.
[pid 26255] write(2, "alan@brick.carrier.duckdns.org: "..., 64alan@brick.carrier.duckdns.org: Permission denied (publickey).
) = 64
[pid 26255] exit_group(255) = ?
SSH is prompting and reading the login secrets through a separate file descriptor; it makes sure to open the current TTY.
Most programs take care to read login secrets from a TTY, so that they can stop the password from being shown by temporarily disabling the "echo" on the TTY. I would expect them to make sure to write the prompt to the same TTY, for robustness sake.
$ SSH_AUTH_SOCK= strace -f rsync x brick:
...
[pid 26255] openat(AT_FDCWD, "/dev/tty", O_RDWR) = 4
[pid 26255] ioctl(4, TCGETS, B38400 opost isig icanon echo ...) = 0
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon -echo ...) = 0
...
[pid 26255] write(4, "Enter passphrase for key '/home/"..., 51Enter passphrase for key '/home/alan/.ssh/id_rsa': ) = 51
[pid 26255] read(4, "", 1) = 0
[pid 26255] write(4, "n", 1
) = 1
[pid 26255] ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, B38400 opost isig icanon echo ...) = 0
...
SSH printed the error message to standard error (open file number 2), not standard output (open file number 1) which rsync would use for its protocol.
[pid 26255] write(2, "alan@brick.carrier.duckdns.org: "..., 64alan@brick.carrier.duckdns.org: Permission denied (publickey).
) = 64
[pid 26255] exit_group(255) = ?
answered Aug 8 at 11:48
sourcejedi
19.9k42683
19.9k42683
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461268%2fhow-is-rsync-able-to-work-with-ssh-when-ssh-reads-and-writes-output-of-its-own%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password