Server Help for a Blind Friend (Solved"

New to Debian (Or Linux in general)? Ask your questions here!

Server Help for a Blind Friend (Solved"

Postby wmichaelb » 2018-04-03 19:31

Hi, I'm scheduled to visit a blind friend next week who is currently using an old DOS system with a Braille readout to access the internet. All I need is a basic server with the brltty software to connect to his brailer, but he has two requests that I'm struggling with. I've used desktop Linux systems for quite a while, but never configured a server before. One request he has is to shut down his system with a simple command like "shutdown". I've gone through multiple posts on this topic, in particular http://how-to.wikia.com/wiki/How_to_allow_non-super_users_to_shutdown_computer_in_Linux and http://www.debianadmin.com/howto-create-your-own-aliases-in-debian.html. I've added my friend's username to the sudoers file, and included:
Code: Select all
ALL= NOPASSWD: /sbin/shutdown

in the file. Then, as in the second link above, I added to .bashrc:
Code: Select all
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

and then to .bash_aliases, I added:
Code: Select all
alias shutdown='sudo /sbin/shutdown'

Now, when I type "/sbin/shutdown now" as his username, the system shuts down, but typing "shutdown" gives me an error message "bash: no such command".
What am I doing wrong?
Secondly, since my friend is blind, he would like the system to automatically log in without entering a password. Is there a way to crate a bash script that will do this on a server install? Any help would be very much appreciated, and thanks in advance.
Last edited by wmichaelb on 2018-04-05 16:47, edited 1 time in total.
Vas you ever in Zinzinnati?
wmichaelb
 
Posts: 14
Joined: 2011-02-23 01:42

Re: Server Help for a Blind Friend

Postby Head_on_a_Stick » 2018-04-03 21:04

Normal users can shutdown the system with:
Code: Select all
systemctl poweroff

Or even just
Code: Select all
/sbin/poweroff

No need to edit sudoers ;)

For automatic login see https://wiki.archlinux.org/index.php/Ge ... al_console
"An you're a prick. Prick on a stick." — acewiza
User avatar
Head_on_a_Stick
 
Posts: 7463
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Server Help for a Blind Friend

Postby None1975 » 2018-04-04 16:37

I think a simpler way to solve the problem would be make a hidden file
Code: Select all
.bash_aliases
and alias for shutdown and reboot to that file. Here is example
Code: Select all
alias shutdown='systemctl poweroff'

For reboot, you should add this
Code: Select all
alias reboot='systemctl reboot'

This allow normal users shutdown and reboot the system.
User avatar
None1975
 
Posts: 443
Joined: 2015-11-29 18:23
Location: Lithuania, Vilnius

Re: Server Help for a Blind Friend

Postby wmichaelb » 2018-04-04 19:47

Thanks, folks! The alias works for root, but not for the user. I created a file /.bash_aliases, and I have tried the lines:
Code: Select all
alias shutdown='systemctl poweroff
alias shutdown='poweroff'
alias shutdown='/sbin/systemctl poweroff
alias shutdown='/sbin/poweroff

but typing the command "shutdown" as a user yields only the error message:
Code: Select all
--bash: shutdown; command not found

Each time I have edited the alias file, I've logged out and back in afterward before trying the command.
Nano will not let me save the modified file as a user, only as root, which makes sense.
Is this perhaps a permissions problem?

Thanks again in advance for any insight you can offer.
Vas you ever in Zinzinnati?
wmichaelb
 
Posts: 14
Joined: 2011-02-23 01:42

Re: Server Help for a Blind Friend

Postby Head_on_a_Stick » 2018-04-04 20:07

wmichaelb wrote:I created a file /.bash_aliases

Try
Code: Select all
cp /.bash_aliases "${HOME}"
sudo chown "${USER}:${USER}" "${HOME}/.bash_aliases"

The file needs to be in the user's home folder and owned by the user ;)

Alternatively, add the "alias" lines to the end of ~/.bashrc (or "${HOME}/.bashrc" to be exact).
"An you're a prick. Prick on a stick." — acewiza
User avatar
Head_on_a_Stick
 
Posts: 7463
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Server Help for a Blind Friend

Postby None1975 » 2018-04-05 12:54

Hello. Check if you have installed package policykit-1. Also you misconfigured alias. It should be as follows:
For shutdown
Code: Select all
alias shutdown='systemctl poweroff'

For reboot
Code: Select all
alias reboot='systemctl reboot'


Pay attention to the quotes.
These lines are not needed:
Code: Select all
alias shutdown='poweroff'
alias shutdown='/sbin/systemctl poweroff
alias shutdown='/sbin/poweroff

If you have problems with file
Code: Select all
.bash_aliases

put those lines that I have given you in to ~/.bashrc in user dir.
User avatar
None1975
 
Posts: 443
Joined: 2015-11-29 18:23
Location: Lithuania, Vilnius

Re: Server Help for a Blind Friend (Solved"

Postby wmichaelb » 2018-04-05 16:50

Moving the .bash_aliases file into the home directory with the proper commands, and following the directions in the Arch link both worked.
The system will now shutdown and reboot using the aliases, and autologins into the user account. He still has a separate root password
so he's not wide open. Thank you very much to all!
Vas you ever in Zinzinnati?
wmichaelb
 
Posts: 14
Joined: 2011-02-23 01:42


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable