SSH 默认进入指定目录? [英] SSH into Specified Directory by Default?

查看:32
本文介绍了SSH 默认进入指定目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,当通过 SSH 连接到客户端时,我会自动放入/home/marco/,但我希望放入/something/other.我希望将我的主目录保留在原处,但我希望自动路由到/something/other/

By default, when SSH'ing into a client I am automatically placed into /home/marco/ but instead I would like to be placed into /something/other. I would prefer to keep my home directory where it is, but I would like to be automatically routed to /something/other/

这可能吗?

*客户端运行Debian 5.04

*The client runs Debian 5.04

推荐答案

可以在登录的同时通过ssh中的命令来改变目录:

You can pass the command in the ssh to change the directory at the same time you login:

ssh -t localhost "cd /tmp ; bash"

你可能会在别名之后得到你想要的:

You might get what you want after an alias:

alias ssh-tmp='ssh -t localhost "cd /tmp ; bash"'

所以命令 'ssh-tmp' 会把你直接放到 tmp 目录下.

So command 'ssh-tmp' will put you directly in the tmp directory.

这篇关于SSH 默认进入指定目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆