登录 shell 仅用于代理(ssh-D)访问?

问题描述 投票:0回答:2

我想在远程主机(例如 proxy.example.com)中创建一个用户,是否有像 git-shell 这样的受限登录 shell 用于仅代理 ssh 访问?

security shell ssh
2个回答
1
投票

自己写!

restricted-shell.c

#include <stdio.h>

int main() {
  printf("You are now connected to the proxy. Press enter to exit.\n");
  scanf("*c");
  exit(0);
}

0
投票

这里是仅为socks5代理创建受限访问用户的代码。

#!/bin/bash

echo -n "Enter username: "
read usernamee;

cd /tmp/
useradd $usernamee -m -d /home/$usernamee -s /bin/rbash
passwd $usernamee
cd /home/$usernamee/
echo 'PATH=""' >> /home/$usernamee/.profile
chmod 555 /home/$usernamee/
chmod 444 .bash_logout .bashrc .profile

只需创建 shell 脚本并使其可执行

chmod +x shell.sh
© www.soinside.com 2019 - 2024. All rights reserved.