steam-deck-utilities icon indicating copy to clipboard operation
steam-deck-utilities copied to clipboard

sudo doesn't wait for password

Open MCPtz opened this issue 3 years ago • 4 comments

I use ssh to connect to my steam deck.

edit: Is this the issue? Zenity pops up a UI dialogue?

$ zenity

(zenity:8556): Gtk-WARNING **: 12:51:11.404: cannot open display: 

Proposed fix: Is there a check for command line only vs UI available?

I've only ever checked for non-interactive vs interactive or login/not, both of which don't help here. The output when I ssh without x-windows:

[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'
Interactive
shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'
Login shell

I couldn't tell you if one of these env variables will say if the SteamDeck has a UI available or not: https://unix.stackexchange.com/a/78220

This occurs within a second or two when I run

./cryo_utilities.sh 
[sudo] password for deck: Sorry, try again.
[sudo] password for deck: 
sudo: no password was provided
sudo: 1 incorrect password attempt

Pre-req:

git clone https://github.com/CryoByte33/steam-deck-utilities.git
cd steam-deck-utilities
chmod +x cryo_utilities.sh

If I start typing a password, it displays in plain text and is interrupted quickly.

Here it is interrupted when I'm at start typ (fake password, as if I my password was start typing the password)

./cryo_utilities.sh 
[sudo] password for deck: start typSorry, try again.
[sudo] password for deck: 
sudo: no password was provided
sudo: 1 incorrect password attempt

I have password setup for sudo, e.g. (fake IPs)

ssh [email protected]
Last login: Sat Nov  5 12:31:35 2022 from 123.456.78.100
(deck@MySteamDeckName ~)$ sudo ls -l
[sudo] password for deck: 
total 296
drwxr-xr-x  3 deck deck   4096 Aug 18 22:01 Applications
drwxr-xr-x  2 deck deck   4096 Aug 18 22:03 Desktop
drwxr-xr-x  2 deck deck   4096 May 29 17:42 Documents
(... and more)

MCPtz avatar Nov 05 '22 19:11 MCPtz

Sorry for the delay, yes the issue here is Zenity needing to bind to a graphical session. The entire flow control of the script relies on zenity for now 😅

CryoByte33 avatar Nov 05 '22 20:11 CryoByte33

I suggest using gum for a cli interface. It can be fetched as a single binary in the installation and has an equivalent for all of the zenity widgets that are used in this script. I'm down to make a pr with the update (unless someone else beats me to it).

TravonteD avatar Nov 06 '22 11:11 TravonteD

@TravonteD feel welcome to! I'm taking a rest day today since the last week has been chaos, but I'll review it tomorrow if you put one in.

As a side note, if we're going to be adding CLI interfaces, better flow control, and even more functionality it might be worth it to swap to an actual language like Go or something. Nothing to action here, just trying to think ahead since bash gets messy at larger scales 🙂

CryoByte33 avatar Nov 06 '22 12:11 CryoByte33

happening to me too, not using SSH directly on konsole from the steam deck.

golephish avatar Nov 07 '22 08:11 golephish

Sorry for the massive delay on this, I have an update completely written in Go with a full-featured CLI in testing right now. I hope to release it within the next month, so I'll keep this open and tag it as an enhancement.

CryoByte33 avatar Feb 08 '23 14:02 CryoByte33

The update has been released, details at https://youtu.be/C9EjXYZUqUs, closing this issue!

CryoByte33 avatar Feb 20 '23 02:02 CryoByte33