Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Server Help for a Blind Friend (Solved"

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
wmichaelb
Posts: 14
Joined: 2011-02-23 01:42

Server Help for a Blind Friend (Solved"

#1 Post by wmichaelb »

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_all ... r_in_Linux and http://www.debianadmin.com/howto-create ... ebian.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?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Server Help for a Blind Friend

#2 Post by Head_on_a_Stick »

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
deadbang

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1388
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 65 times

Re: Server Help for a Blind Friend

#3 Post by None1975 »

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.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

wmichaelb
Posts: 14
Joined: 2011-02-23 01:42

Re: Server Help for a Blind Friend

#4 Post by wmichaelb »

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?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Server Help for a Blind Friend

#5 Post by Head_on_a_Stick »

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).
deadbang

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1388
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 65 times

Re: Server Help for a Blind Friend

#6 Post by None1975 »

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.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

wmichaelb
Posts: 14
Joined: 2011-02-23 01:42

Re: Server Help for a Blind Friend (Solved"

#7 Post by wmichaelb »

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?

Post Reply