Why do I get a “Connection to [host] closed by remote host” error over SFTP connection?
up vote
2
down vote
favorite
I'd like to connect as user
to a remote host through SFTP.
Moreover, I'd like to land into a specific directory (say /home/user/dir
). I've created user with default working directory as /home/user/dir
and set a /home/user/.ssh/authorized_key
file to host my public key.
However, upon connexion using sftp -P 7000 user@host.com
and after typing user
's password, I get the following error immediatly: Connection to host.com closed by remote host. Connection closed.
Any idea about where it might come from (or how to debug that kind of issue)?
UPDATE
I was finally to connect as user
because authorized_key
didn't have the proper rights. However, I got the exact same error message while trying to land in /home/user/dir
with another user (say user2
) which was granted group access to /home/user/dir
. But as it turn out in this response, SFTP chroot jail does not allow that by design. I'll try to use symbolic links between /home/user/dir
and /home/user2/dir
to solve this issue.
linux ssh sftp
|
show 2 more comments
up vote
2
down vote
favorite
I'd like to connect as user
to a remote host through SFTP.
Moreover, I'd like to land into a specific directory (say /home/user/dir
). I've created user with default working directory as /home/user/dir
and set a /home/user/.ssh/authorized_key
file to host my public key.
However, upon connexion using sftp -P 7000 user@host.com
and after typing user
's password, I get the following error immediatly: Connection to host.com closed by remote host. Connection closed.
Any idea about where it might come from (or how to debug that kind of issue)?
UPDATE
I was finally to connect as user
because authorized_key
didn't have the proper rights. However, I got the exact same error message while trying to land in /home/user/dir
with another user (say user2
) which was granted group access to /home/user/dir
. But as it turn out in this response, SFTP chroot jail does not allow that by design. I'll try to use symbolic links between /home/user/dir
and /home/user2/dir
to solve this issue.
linux ssh sftp
1
First add-vvv
:sftp -P 7000 user@host.com -vvv
and show output
– Tomasz Jakub Rup
Nov 9 at 14:24
I get the exact same output :Connection to host.com closed by remote host. Connection closed.
– Crolle
Nov 9 at 14:44
Did you set /home/user/dir as your user's $HOME ? or what else did you do to "land into a specific directory" ? Did logging in work before you changed that directory?
– hyph
Nov 9 at 14:52
Sorry, my fault:sftp -P 7000 -vvv user@host.com
– Tomasz Jakub Rup
Nov 9 at 14:59
@hyph I defineduser
default directory usingusermod -m -d /home/user/dir user
@Tomasz Jakub Rup The log is quite extensive : pastebin.com/0dRZBPUS
– Crolle
Nov 9 at 15:42
|
show 2 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'd like to connect as user
to a remote host through SFTP.
Moreover, I'd like to land into a specific directory (say /home/user/dir
). I've created user with default working directory as /home/user/dir
and set a /home/user/.ssh/authorized_key
file to host my public key.
However, upon connexion using sftp -P 7000 user@host.com
and after typing user
's password, I get the following error immediatly: Connection to host.com closed by remote host. Connection closed.
Any idea about where it might come from (or how to debug that kind of issue)?
UPDATE
I was finally to connect as user
because authorized_key
didn't have the proper rights. However, I got the exact same error message while trying to land in /home/user/dir
with another user (say user2
) which was granted group access to /home/user/dir
. But as it turn out in this response, SFTP chroot jail does not allow that by design. I'll try to use symbolic links between /home/user/dir
and /home/user2/dir
to solve this issue.
linux ssh sftp
I'd like to connect as user
to a remote host through SFTP.
Moreover, I'd like to land into a specific directory (say /home/user/dir
). I've created user with default working directory as /home/user/dir
and set a /home/user/.ssh/authorized_key
file to host my public key.
However, upon connexion using sftp -P 7000 user@host.com
and after typing user
's password, I get the following error immediatly: Connection to host.com closed by remote host. Connection closed.
Any idea about where it might come from (or how to debug that kind of issue)?
UPDATE
I was finally to connect as user
because authorized_key
didn't have the proper rights. However, I got the exact same error message while trying to land in /home/user/dir
with another user (say user2
) which was granted group access to /home/user/dir
. But as it turn out in this response, SFTP chroot jail does not allow that by design. I'll try to use symbolic links between /home/user/dir
and /home/user2/dir
to solve this issue.
linux ssh sftp
linux ssh sftp
edited Nov 14 at 11:13
asked Nov 9 at 13:08
Crolle
1112
1112
1
First add-vvv
:sftp -P 7000 user@host.com -vvv
and show output
– Tomasz Jakub Rup
Nov 9 at 14:24
I get the exact same output :Connection to host.com closed by remote host. Connection closed.
– Crolle
Nov 9 at 14:44
Did you set /home/user/dir as your user's $HOME ? or what else did you do to "land into a specific directory" ? Did logging in work before you changed that directory?
– hyph
Nov 9 at 14:52
Sorry, my fault:sftp -P 7000 -vvv user@host.com
– Tomasz Jakub Rup
Nov 9 at 14:59
@hyph I defineduser
default directory usingusermod -m -d /home/user/dir user
@Tomasz Jakub Rup The log is quite extensive : pastebin.com/0dRZBPUS
– Crolle
Nov 9 at 15:42
|
show 2 more comments
1
First add-vvv
:sftp -P 7000 user@host.com -vvv
and show output
– Tomasz Jakub Rup
Nov 9 at 14:24
I get the exact same output :Connection to host.com closed by remote host. Connection closed.
– Crolle
Nov 9 at 14:44
Did you set /home/user/dir as your user's $HOME ? or what else did you do to "land into a specific directory" ? Did logging in work before you changed that directory?
– hyph
Nov 9 at 14:52
Sorry, my fault:sftp -P 7000 -vvv user@host.com
– Tomasz Jakub Rup
Nov 9 at 14:59
@hyph I defineduser
default directory usingusermod -m -d /home/user/dir user
@Tomasz Jakub Rup The log is quite extensive : pastebin.com/0dRZBPUS
– Crolle
Nov 9 at 15:42
1
1
First add
-vvv
: sftp -P 7000 user@host.com -vvv
and show output– Tomasz Jakub Rup
Nov 9 at 14:24
First add
-vvv
: sftp -P 7000 user@host.com -vvv
and show output– Tomasz Jakub Rup
Nov 9 at 14:24
I get the exact same output :
Connection to host.com closed by remote host. Connection closed.
– Crolle
Nov 9 at 14:44
I get the exact same output :
Connection to host.com closed by remote host. Connection closed.
– Crolle
Nov 9 at 14:44
Did you set /home/user/dir as your user's $HOME ? or what else did you do to "land into a specific directory" ? Did logging in work before you changed that directory?
– hyph
Nov 9 at 14:52
Did you set /home/user/dir as your user's $HOME ? or what else did you do to "land into a specific directory" ? Did logging in work before you changed that directory?
– hyph
Nov 9 at 14:52
Sorry, my fault:
sftp -P 7000 -vvv user@host.com
– Tomasz Jakub Rup
Nov 9 at 14:59
Sorry, my fault:
sftp -P 7000 -vvv user@host.com
– Tomasz Jakub Rup
Nov 9 at 14:59
@hyph I defined
user
default directory using usermod -m -d /home/user/dir user
@Tomasz Jakub Rup The log is quite extensive : pastebin.com/0dRZBPUS– Crolle
Nov 9 at 15:42
@hyph I defined
user
default directory using usermod -m -d /home/user/dir user
@Tomasz Jakub Rup The log is quite extensive : pastebin.com/0dRZBPUS– Crolle
Nov 9 at 15:42
|
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
How to debug
First step is running command with verbose flag:
sftp -P 7000 -vvv user@host.com
Analyze of log
Connection are estabilished
debug1: Authentication succeeded (publickey).
but, ssh
cannot set non-blocking mode:
debug3: fd 1 is not O_NONBLOCK
Connection to host.com closed by remote host.
Probably Your shell initialization file (.bashrc
, .bash_profile
, etc.) breaking ssh connection
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
How to debug
First step is running command with verbose flag:
sftp -P 7000 -vvv user@host.com
Analyze of log
Connection are estabilished
debug1: Authentication succeeded (publickey).
but, ssh
cannot set non-blocking mode:
debug3: fd 1 is not O_NONBLOCK
Connection to host.com closed by remote host.
Probably Your shell initialization file (.bashrc
, .bash_profile
, etc.) breaking ssh connection
add a comment |
up vote
1
down vote
How to debug
First step is running command with verbose flag:
sftp -P 7000 -vvv user@host.com
Analyze of log
Connection are estabilished
debug1: Authentication succeeded (publickey).
but, ssh
cannot set non-blocking mode:
debug3: fd 1 is not O_NONBLOCK
Connection to host.com closed by remote host.
Probably Your shell initialization file (.bashrc
, .bash_profile
, etc.) breaking ssh connection
add a comment |
up vote
1
down vote
up vote
1
down vote
How to debug
First step is running command with verbose flag:
sftp -P 7000 -vvv user@host.com
Analyze of log
Connection are estabilished
debug1: Authentication succeeded (publickey).
but, ssh
cannot set non-blocking mode:
debug3: fd 1 is not O_NONBLOCK
Connection to host.com closed by remote host.
Probably Your shell initialization file (.bashrc
, .bash_profile
, etc.) breaking ssh connection
How to debug
First step is running command with verbose flag:
sftp -P 7000 -vvv user@host.com
Analyze of log
Connection are estabilished
debug1: Authentication succeeded (publickey).
but, ssh
cannot set non-blocking mode:
debug3: fd 1 is not O_NONBLOCK
Connection to host.com closed by remote host.
Probably Your shell initialization file (.bashrc
, .bash_profile
, etc.) breaking ssh connection
answered Nov 9 at 20:04
Tomasz Jakub Rup
560313
560313
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1374078%2fwhy-do-i-get-a-connection-to-host-closed-by-remote-host-error-over-sftp-conn%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
First add
-vvv
:sftp -P 7000 user@host.com -vvv
and show output– Tomasz Jakub Rup
Nov 9 at 14:24
I get the exact same output :
Connection to host.com closed by remote host. Connection closed.
– Crolle
Nov 9 at 14:44
Did you set /home/user/dir as your user's $HOME ? or what else did you do to "land into a specific directory" ? Did logging in work before you changed that directory?
– hyph
Nov 9 at 14:52
Sorry, my fault:
sftp -P 7000 -vvv user@host.com
– Tomasz Jakub Rup
Nov 9 at 14:59
@hyph I defined
user
default directory usingusermod -m -d /home/user/dir user
@Tomasz Jakub Rup The log is quite extensive : pastebin.com/0dRZBPUS– Crolle
Nov 9 at 15:42