Linux用户不能用chgrap,linux – 无法使用Synology NAS上的/ bin / bash shell通过SSH登录任何帐户...

我正在尝试将bash安装为在嵌入式设备(Synology DS212 NAS)上运行的ARM

Linux上的默认shell.但是有些事情确实存在问题,我无法弄清楚它是什么.

症状:

1)Root有/ bin / bash作为默认shell,可以通过SSH正常登录:

$grep root /etc/passwd

root:x:0:0:root:/root:/bin/bash

$ssh root@NAS

root@NAS's password:

Last login: Sun Dec 16 14:06:56 2012 from desktop

#

2)joeuser将/ bin / bash作为默认shell,并在尝试通过SSH登录时收到“权限被拒绝”:

$grep joeuser /etc/passwd

joeuser:x:1029:100:Joe User:/home/joeuser:/bin/bash

$ssh joeuser@localhost

joeuser@NAS's password:

Last login: Sun Dec 16 14:07:22 2012 from desktop

Permission denied,please try again.

Connection to localhost closed.

3)将joeuser的shell更改回/ bin / sh:

$grep joeuser /etc/passwd

joeuser:x:1029:100:Joe User:/home/joeuser:/bin/sh

$ssh joeuser@localhost

Last login: Sun Dec 16 15:50:52 2012 from localhost

$

为了让事情变得更奇怪,我可以使用串行控制台(!)使用/ bin / bash以joeuser身份登录.另外一个su – joeuser作为root工作正常,所以bash二进制文件本身工作正常.

在绝望的行为中,我在/ etc / passwd上将joeuser的uid更改为0,但也没有工作,因此它似乎与某些权限无关.

似乎bash正在做一些sshd不喜欢的额外检查,并阻止非root用户的连接.也许某种健全性检查 – 或终端仿真 – 触发SIGCHLD,但仅在通过ssh调用时.

我已经浏览了sshd_config上的每个项目,并且还将SSHD置于调试模式,但没有发现任何奇怪的内容.这是我的/ etc / ssh / sshd_config:

LogLevel DEBUG

LoginGraceTime 2m

PermitRootLogin yes

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile %h/.ssh/authorized_keys

ChallengeResponseAuthentication no

UsePAM yes

AllowTcpForwarding no

ChrootDirectory none

Subsystem sftp internal-sftp -f DAEMON -u 000

这是来自/usr/syno / sbin / sshd -d的输出,显示了joeuser尝试登录失败的尝试,使用/ bin / bash作为shell:

debug1: Config token is loglevel

debug1: Config token is logingracetime

debug1: Config token is permitrootlogin

debug1: Config token is rsaauthentication

debug1: Config token is pubkeyauthentication

debug1: Config token is authorizedkeysfile

debug1: Config token is challengeresponseauthentication

debug1: Config token is usepam

debug1: Config token is allowtcpforwarding

debug1: Config token is chrootdirectory

debug1: Config token is subsystem

debug1: HPN Buffer Size: 87380

debug1: sshd version OpenSSH_5.8p1-hpn13v11

debug1: read PEM private key done: type RSA

debug1: private host key: #0 type 1 RSA

debug1: read PEM private key done: type DSA

debug1: private host key: #1 type 2 DSA

debug1: read PEM private key done: type ECDSA

debug1: private host key: #2 type 3 ECDSA

debug1: rexec_argv[0]='/usr/syno/sbin/sshd'

debug1: rexec_argv[1]='-d'

Set /proc/self/oom_adj from 0 to -17

debug1: Bind to port 22 on ::.

debug1: Server TCP RWIN socket size: 87380

debug1: HPN Buffer Size: 87380

Server listening on :: port 22.

debug1: Bind to port 22 on 0.0.0.0.

debug1: Server TCP RWIN socket size: 87380

debug1: HPN Buffer Size: 87380

Server listening on 0.0.0.0 port 22.

debug1: Server will not fork when running in debugging mode.

debug1: rexec start in 6 out 6 newsock 6 pipe -1 sock 9

debug1: inetd sockets after dupping: 4,4

Connection from 127.0.0.1 port 52212

debug1: HPN Disabled: 0,HPN Buffer Size: 87380

debug1: Client protocol version 2.0; client software version OpenSSH_5.8p1-hpn13v11

SSH: Server;Ltype: Version;Remote: 127.0.0.1-52212;Protocol: 2.0;Client: OpenSSH_5.8p1-hpn13v11

debug1: match: OpenSSH_5.8p1-hpn13v11 pat OpenSSH*

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_5.8p1-hpn13v11

debug1: permanently_set_uid: 1024/100

debug1: MYFLAG IS 1

debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: AUTH STATE IS 0

debug1: REQUESTED ENC.NAME is 'aes128-ctr'

debug1: kex: client->server aes128-ctr hmac-md5 none

SSH: Server;Ltype: Kex;Remote: 127.0.0.1-52212;Enc: aes128-ctr;MAC: hmac-md5;Comp: none

debug1: REQUESTED ENC.NAME is 'aes128-ctr'

debug1: kex: server->client aes128-ctr hmac-md5 none

debug1: expecting SSH2_MSG_KEX_ECDH_INIT

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: KEX done

debug1: userauth-request for user joeuser service ssh-connection method none

SSH: Server;Ltype: Authname;Remote: 127.0.0.1-52212;Name: joeuser

debug1: attempt 0 failures 0

debug1: Config token is loglevel

debug1: Config token is logingracetime

debug1: Config token is permitrootlogin

debug1: Config token is rsaauthentication

debug1: Config token is pubkeyauthentication

debug1: Config token is authorizedkeysfile

debug1: Config token is challengeresponseauthentication

debug1: Config token is usepam

debug1: Config token is allowtcpforwarding

debug1: Config token is chrootdirectory

debug1: Config token is subsystem

debug1: PAM: initializing for "joeuser"

debug1: PAM: setting PAM_RHOST to "localhost"

debug1: PAM: setting PAM_TTY to "ssh"

debug1: userauth-request for user joeuser service ssh-connection method password

debug1: attempt 1 failures 0

debug1: do_pam_account: called

Accepted password for joeuser from 127.0.0.1 port 52212 ssh2

debug1: monitor_child_preauth: joeuser has been authenticated by privileged process

debug1: PAM: establishing credentials

User child is on pid 9129

debug1: Entering interactive session for SSH2.

debug1: server_init_dispatch_20

debug1: server_input_channel_open: ctype session rchan 0 win 65536 max 16384

debug1: input_session_request

debug1: channel 0: new [server-session]

debug1: session_new: session 0

debug1: session_open: channel 0

debug1: session_open: session 0: link with channel 0

debug1: server_input_channel_open: confirm session

debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0

debug1: server_input_channel_req: channel 0 request pty-req reply 1

debug1: session_by_channel: session 0 channel 0

debug1: session_input_channel_req: session 0 req pty-req

debug1: Allocating pty.

debug1: session_new: session 0

debug1: session_pty_req: session 0 alloc /dev/pts/1

debug1: server_input_channel_req: channel 0 request shell reply 1

debug1: session_by_channel: session 0 channel 0

debug1: session_input_channel_req: session 0 req shell

debug1: Setting controlling tty using TIOCSCTTY.

debug1: Received SIGCHLD.

debug1: session_by_pid: pid 9130

debug1: session_exit_message: session 0 channel 0 pid 9130

debug1: session_exit_message: release channel 0

debug1: session_by_tty: session 0 tty /dev/pts/1

debug1: session_pty_cleanup: session 0 release /dev/pts/1

Received disconnect from 127.0.0.1: 11: disconnected by user

debug1: do_cleanup

debug1: do_cleanup

debug1: PAM: cleanup

debug1: PAM: closing session

debug1: PAM: deleting credentials

击:

# bash --version

GNU bash,version 3.2.49(1)-release (arm-none-linux-gnueabi)

Copyright (C) 2007 Free Software Foundation,Inc.

bash二进制文件是从源代码交叉编译的.我也试过使用Optware distribution的预编译二进制文件,但是遇到了完全相同的问题.我使用objdump -x检查了缺少的共享库,但它们都在那里.

任何想法可能导致这个“权限被拒绝,请再试一次.”?我几乎潜入了bash源代码进行调查,但试图避免数小时追逐可能是愚蠢的事情.

编辑:添加有关bash和系统的更多信息

$ls -la /bin/bash

-rwxr-xr-x 1 root root 724676 Dec 15 23:57 /bin/bash

$ file /bin/bash

/bin/bash: ELF 32-bit LSB executable,ARM,version 1 (SYSV),dynamically linked (uses shared libs),for GNU/Linux 2.6.14,stripped

$ uname -a

Linux NAS 2.6.32.12 #2661 Mon Nov 12 23:10:15 CST 2012 armv5tel GNU/Linux synology_88f6282_212+

$grep bash /etc/shells

/bin/bash

/bin/bash2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值