Allow user to set up an SSH tunnel, but nothing else

后端 未结 10 2152
小蘑菇
小蘑菇 2020-12-22 16:47

I\'d like to allow a user to set up an SSH tunnel to a particular machine on a particular port (say, 5000), but I want to restrict this user as much as possible. (Authentica

10条回答
  •  情书的邮戳
    2020-12-22 16:59

    I made a C program which looks like this:

    #include 
    #include 
    #include 
    #include 
    void sig_handler(int signo)
    {
        if (signo == SIGHUP)
            exit(0);
    }
    
    int main()
    {
        signal(SIGINT, &sig_handler);
        signal(SIGTSTP, &sig_handler);
    
        printf("OK\n");
        while(1)
            sleep(1);
        exit(0);
    }
    

    I set the restricted user's shell to this program.

    I don't think the restricted user can execute anything, even if they do ssh server command, because the commands are executed using the shell, and this shell does not execute anything.

提交回复
热议问题