You are not logged in.

#1 2017-04-23 21:03:51

Panadestein
Member
From: Lille, France
Registered: 2017-04-08
Posts: 51

Problems executing superuser command in i3

Hello everyone!

I have been struggling with this problem for a while but I haven't found any clarifying information, so I humbly ask for your help. I am using the amazing i3wm as my regular desktop environment, everything is working fine except for some key binding that require superuser privileges. For instance

  bindsym $mod+F9 exec --no-startup-id gksudo bash ~/.config/i3/mount.sh 

where mount.sh is an small script intended to mount an USB key (needs to be elaborated, this is just a test)

 
#!/bin/bash
 
sudo mkdir /mnt/MyDrive
sudo mount /dev/sdc /mnt/MyDrive

 

when I press the keys combination I get the gksudo window, but nothing happens after input the password (the device is not mounted). I tested from the command line

 gksudo bash mount.sh 

and it worked, so I think is an i3's issue. Thanks in advance.

Last edited by Panadestein (2017-04-23 21:25:18)


python -c 'import this' | awk 'NR == 5'

Offline

#2 2017-04-23 21:35:46

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Problems executing superuser command in i3

I'd bet something about the "~" does not work and it's not getting translated into your user's home.

Offline

#3 2017-04-24 02:29:14

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: Problems executing superuser command in i3

I would suggest few alternative approaches/improvements that would make things simpler
   1. put gksudo in your script so you execute only ~/.config/i3/mount.sh from i3
   2. put mount.sh in $HOME/bin/mount.sh, and have $HOME/bin in your path, so you don't need to specify paths for all your personal scripts.
   3. Even better is to get udevil, and use "udevil mount <your drive>", without using sudo.
   4. If you are running script with gksudo, why you are having sudo in your script. (gksudo * sudo)

Offline

#4 2017-04-24 08:45:41

Panadestein
Member
From: Lille, France
Registered: 2017-04-08
Posts: 51

Re: Problems executing superuser command in i3

Docbroke wrote:

I would suggest few alternative approaches/improvements that would make things simpler
   1. put gksudo in your script so you execute only ~/.config/i3/mount.sh from i3
   2. put mount.sh in $HOME/bin/mount.sh, and have $HOME/bin in your path, so you don't need to specify paths for all your personal scripts.
   3. Even better is to get udevil, and use "udevil mount <your drive>", without using sudo.
   4. If you are running script with gksudo, why you are having sudo in your script. (gksudo * sudo)

Thanks for your reply! I found all your suggestions very helpful, and yes, I think I will use udevil mount <device> , using the ideas on this post
https://bbs.archlinux.org/viewtopic.php?id=185712 . With respect to the 4th suggestion, of course is not necessary to put sudo on the script, it was an stupid mistake.


python -c 'import this' | awk 'NR == 5'

Offline

Board footer

Powered by FluxBB