You are not logged in.
This is not Arch related so feel free to ignore...
The goal is to modify a users /etc/passwd entry so it runs a script instead of a shell.
As a proof of concept, this works:
#!/bin/bash
read -p "Enter your selection: " selection
case "$selection" in
1) /usr/bin/ssh user@192.168.32.20;;
*) exit 0;;
esac
If I su to a user with that as their "shell" I see the prompt, I can press 1 and login to the remote box
Then I thought I'd try to add some logging and script became this:
#!/bin/bash
read -p "Enter your selection: " selection
case "$selection" in
1) /usr/bin/script -c "/usr/bin/ssh user@192.168.32.20";;
*) exit 0;;
esac
This does work when run directly at the command line but does not work when set as a users shell in /etc/passwd... it's like it executes the script over and over again. The output is:
Enter your selection: 1
Script started, file is typescript
Enter your selection: 1
Script started, file is typescript
So adding the /usr/bin/script to the mix is causing a problem.
What is the cause? I'm assuming it's something to do with subshells but I thought the '-c' would resolve that.
How can I make it do as expected (without modifying .profile if possible.) The end-goal is for users to log in and be presented with a list of servers to connect to
Is there a better way to accomplish this?
Last edited by oliver (2015-01-20 16:38:11)
Offline
You might just try bash instead of script, but then again it could probably be done somehow with bashrc. Usually something like this, you use sh.
Last edited by nomorewindows (2015-01-20 16:40:24)
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
I'm trying to avoid modifying profiles due to the archaic way we handle user accounts at work... it would be one more thing to maintain but it's certainly not impossible.
I think I will switch to /bin/sh anyway - just used bash out of habit
And reading the first post back, I'm not sure it's entirely clear... but it works at the command line and only fails when it's set as a user's shell. I'm not sure what the difference is
Last edited by oliver (2015-01-20 16:51:48)
Offline