为 ssh 设置 shell

最近用 termux + tsu + sshd + zsh 远程,发现连接后使用的是 bash 而不是我默认的 zsh。

修改 /ect/profile~/.profile

# Force use zsh
zsh="/data/data/com.termux/files/usr/bin/zsh"
if [ "$SHELL" != "$zsh" -a -n "$SSH_TTY" -a -x "$zsh" ]; then
        export SHELL="$zsh"
        exec $zsh -l
fi

# ......

参考:bash - specify shell for ssh session

ssh 密码连接 Termux

网上都说只能通过秘钥连接,实则不然。用 passwd 命令设置一下密码就行了,用户名都不用。

# 设置 Termux 密码
$ passwd
New password:
Retype new password:
New password was successfully set.

# ssh 密码连接 Termux
$ ssh -p 8022 example.com
The authenticity of host '[example.com]:8022' can't be established.
ECDSA key fingerprint is SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ+0123456789abcdef.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
[email protected]'s password: 

Welcome to Termux!

标签: android, ssh, termux

仅有一条评论

  1. Ajiang Ajiang 访客 Chrome Android 10 回复

    这玩意儿功能强大

添加新评论

注意:已开启评论过滤器,无中文无法评论!
泡泡表情