我犯了一个愚蠢的错误…我正忙着玩busybox,并用chsh将root shell从/ bin / sh切换到/ bin / busybox,这似乎破坏了SSH的访问。
当我做:
root@dev:~$ ssh [email protected]
我得到:
[email protected]'s password: BusyBox v1.22.1 (2015-06-19 07:36:41 CEST) multi-call binary. BusyBox is copyrighted by many authors between 1998-2012. Licensed under GPLv2. See source distribution for detailed copyright notices. Usage: busybox [function [arguments]...] or: busybox --list or: function [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as. Currently defined functions: [, [[, addgroup, adduser, ar, ash, awk, basename, brctl, bunzip2, bzcat, cat, chattr, chgrp, chmod, chown, chroot, chvt, clear, cmp, cp, cpio, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, df, diff, dirname, dmesg, dnsdomainname, du, dumpkmap, dumpleases, echo, egrep, env, expr, false, fbset, fdisk, fgrep, find, flock, free, fsck, fstrim, fuser, getty, grep, groups, gunzip, gzip, halt, head, hexdump, hostname, hwclock, id, ifconfig, ifdown, ifup, insmod, ip, kill, killall, less, ln, loadfont, loadkmap, logger, logname, losetup, ls, lsmod, md5sum, microcom, mkdir, mkfifo, mknod, mkswap, mktemp, modprobe, more, mount, mv, nc, netstat, nohup, nslookup, od, openvt, patch, pidof, pivot_root, poweroff, printf, ps, pwd, rdate, readlink, realpath, reboot, renice, reset, rfkill, rm, rmdir, rmmod, route, run-parts, sed, seq, setconsole, sh, sha3sum, sleep, sort, start-stop-daemon, stat, strings, stty, sulogin, swapoff, swapon, switch_root, sync, sysctl, tail, tar, tee, telnet, test, tftp, time, top, touch, tr, true, tty, udhcpc, udhcpd, umount, uname, uniq, unzip, uptime, users, usleep, vi, watch, wc, wget, which, who, whoami, xargs, yes, zcat Connection to ip.of.ser.ver closed.
从技术上讲,我不确定为什么它closures了连接。 非技术上我不知道如何解决这个问题,并想重新获得设备的访问权限。
据我所知,我只需要编辑/etc/passwd并将其更改回来,但我怎么能做到这一点呢?
连接是closures的,因为调用/bin/busybox只是显示你看到的输出,但不会启动一个shell会话(在terminal上试用)。 您需要创build符号链接/usr/bin/ash -> /bin/busybox并调用/usr/bin/ash来启动busybox shell。
您可能需要通过救援系统来解决这个问题,以便将其改回。
如果您已启用对该机器的SFTP访问,请尝试使用它。 有可能是它被configuration为不需要有效的shell(internal-sftp)。 然后你可以编辑你的/ etc / passwd文件。