windows PuTTY:更改默认 SSH 登录目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3530433/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PuTTY: Change default SSH login directory
提问by Bernd
In Windows, I use PuTTYto log in a Linux-based remote server via SSH.
在 Windows 中,我使用PuTTY通过 SSH 登录基于 Linux 的远程服务器。
Is is possible to change the default directoryentry point I get to after I connect and login? (That would be a nice time saver.)
连接和登录后是否可以更改默认目录入口点?(这将是一个很好的节省时间。)
e.g. from server/home/
to server/home/subdir/subdir/
例如从server/home/
到server/home/subdir/subdir/
采纳答案by Sjoerd
- Add
cd subdir/subdir
to~/.bashrc
or~/.bash_profile
, or - change the home directory of the user.
- 添加
cd subdir/subdir
到~/.bashrc
或~/.bash_profile
,或 - 更改用户的主目录。
回答by lagivan
You can also change the directory within PuTTYitself:
您还可以更改PuTTY本身中的目录:
Configuration → Connection → SSH
Fill in the "Remote command" field with the following:
cd subdir/subdir ; /bin/bash
配置 → 连接 → SSH
在“远程命令”字段中填写以下内容:
cd subdir/subdir ; /bin/bash
回答by David Cook
You could use screen to keep your current directory by always logging into the same screen session.
您可以使用 screen 通过始终登录到同一个 screen 会话来保留当前目录。
Add the screen command with parameters to your putty saved session under SSH>Remote Command. See the screen documentation for which parameters to use.
将带有参数的 screen 命令添加到 SSH>Remote Command 下的腻子保存会话中。请参阅屏幕文档以了解要使用的参数。
screen -R -O -t mysession -S mysession -f
回答by Ian
Depends on a lot of things. Mainly the server operating system. Most SSH servers run Linux or Unix of some flavor. When you connect via any method of remote text login (as SSH is one member of this category) such a system will automatically spawn a shell process to talk to you. That's probably "bash", and it runs various things on startup. Check out
取决于很多事情。主要是服务器操作系统。大多数 SSH 服务器运行某种风格的 Linux 或 Unix。当您通过任何远程文本登录方法进行连接时(因为 SSH 是该类别的一个成员),这样的系统将自动生成一个 shell 进程来与您交谈。那可能是“bash”,它在启动时运行各种东西。查看
man bash
男人 bash
to learn more. One of the many things you can do is cd to a subfolder.
了解更多。您可以做的许多事情之一是 cd 到子文件夹。