Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 23 Oct 2017, 13:09
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Derivatives
Light-Debian-Core-Live-CD-Wheezy + Porteus-Wheezy
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 271 of 283 [4236 Posts]   Goto page: Previous 1, 2, 3, ..., 269, 270, 271, 272, 273, ..., 281, 282, 283 Next
Author Message
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Thu 18 Dec 2014, 16:50    Post subject:  

Hi Toni,

Quote:
Logout and login and I can shutdown, reboot, save2flash without password prompt.
It will work also for any older DD version. Nice Smile

Smile

Quote:
I'm sure you do not have problem because pburn is also installed in your official Debian Wheezy.
Pburn has included link /usr/bin/gtkdialog4

Nice find, Toni!, glad it's solved.
Indeed I have pburn installed on my official install.

Here's script with yad dialogs for activate/deactivate required password for shutdown/reboot.
It 'toggles' activate and deactivate, depending if the user is member of group wheel or not.
Tell me if you like something changed for it.
I'll leave the menu entry name up to you, something like: Activate/Deactivate-shutdown-password-required maybe?
Attached: shutdown-pass-activate_deactivate.tar.gz

Edit: Made small mistake, re-uploaded fixed version.

Fred
shutdown-pass-activate_deactivate.tar.gz
Description  Activate/Deactivate password required for shutdown and reboot
gz

 Download 
Filename  shutdown-pass-activate_deactivate.tar.gz 
Filesize  867 Bytes 
Downloaded  125 Time(s) 

Last edited by fredx181 on Fri 19 Dec 2014, 18:09; edited 1 time in total
Back to top
View user's profile Send private message 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Fri 19 Dec 2014, 11:51    Post subject:  

fredx181 wrote:
I'll leave the menu entry name up to you, something like: Activate/Deactivate-shutdown-password-required maybe?
Attached: shutdown-pass-activate_deactivate.tar.gz

Thanks, Fred, looks much better this way Smile
I will put the script in /opt/bin. lets keep /opt/bin for scripts available only in DD without making deb packages for them (if you do not mind). And for all new made (and not included yet) deb packages start using /usr/local/bin instead /opt/bin.
I think Activate/Deactivate Shutdown Password is good name.

I will add menu entry as line for IceWM /home/puppy/.icewm/menu and /etc/skel/.icewm/menu and for Jwm in /home/puppy/.jwm/jwm.head and /etc/skel/.jwm/jwm.head
I tried to use local desktop and menu files for user account only but seems Jwm does not read ~/.menu content for local user files. I thought it is caused by menu-puppy from Terry somehow but no. After deleting all files for menu-puppy, restoring the link to point /usr/bin/update-menus and installing official Jwm deb package update-menus command also does not read files in ~/.menu.
IceWM does it without problem and adds to the menu what is available in ~/.menu.
Strange issue that needs investigation some day.
I also forgot about IceWM in the instruction post. It needs adding sudo in /home/puppy/.icewm/preferences:
Code:
#  Command to shutdown the system
ShutdownCommand="sudo /sbin/poweroff"

#  Command to reboot the system
RebootCommand="sudo /sbin/reboot"


Toni

_________________
Farewell, Nooby, you will be missed...
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Fri 19 Dec 2014, 16:34    Post subject:  

Hi Toni,

Quote:
I will add menu entry as line for IceWM /home/puppy/.icewm/menu and /etc/skel/.icewm/menu and for Jwm in /home/puppy/.jwm/jwm.head and /etc/skel/.jwm/jwm.head
I tried to use local desktop and menu files for user account only but seems Jwm does not read ~/.menu content for local user files. I thought it is caused by menu-puppy from Terry somehow but no.
.....
.....


I didn't realize adding a menu entry for specific user would be so complicated.
Just tried on Jwm version if placing a .desktop file in ~/.local/share/applications and do "update-menus" would work, but it seems not.
On OpenBox version this works.
Looks like you figured all out already but just for info: the script gives message and exits when logged in as root.
So the .desktop file could as well be in /usr/share/applications, then doing "update-menus" should add it to menu.

Fred
Back to top
View user's profile Send private message 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Fri 19 Dec 2014, 16:57    Post subject:  

Hi, Fred.
fredx181 wrote:
Just tried on Jwm version if placing a .desktop file in ~/.local/share/applications and do "update-menus" would work, but it seems not.
On OpenBox version this works.

Terry's mk-jwm.menu (menu-puppy) does not support ~/.local/share/applications as path if I do not mistake. I have this in mind and possible alternative menu script that works with any available path for .desktop files.
But the problem is actually the standard debian update-menus method does not work with Jwm after restoring with System -> Menu Debian.
Adding menu file in /home/puppy/.menu the menu entry appears in IceWM but not in Jwm. Seems like update-menus does not work well with Jwm.

Small issue with shutdown-pass-activate_deactivate:
If I click cancel on gsu window it gives message the user is added to group wheel but it is not actually added.

Toni
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Fri 19 Dec 2014, 18:06    Post subject:  

Toni wrote:
Small issue with shutdown-pass-activate_deactivate:
If I click cancel on gsu window it gives message the user is added to group wheel but it is not actually added.


Yes, that needs to be fixed, Thanks!
Forgot to set $ret variable (ret=$?) after commands.
Attached fixed: shutdown-pass-activate_deactivate.tar.gz

Fred
shutdown-pass-activate_deactivate.tar.gz
Description  Fixed shutdown-pass-activate_deactivate.tar.gz
gz

 Download 
Filename  shutdown-pass-activate_deactivate.tar.gz 
Filesize  867 Bytes 
Downloaded  110 Time(s) 
Back to top
View user's profile Send private message 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Sat 20 Dec 2014, 14:54    Post subject:  

Thanks, Fred!

I will change the link in next version changes post to point the new file.
Just for information I'm experimenting with mjwm menu and I think I will include it as third menu method in Jwm version. It reads ~/.local/share/applications or any other paths scanning for desktop files. In combinantion with Terry's mk-jwm.menu I can make it auto-update the programs after installing/removing new packages.
Then I will continue modding DD packages for the testing repository.

Toni
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Sat 20 Dec 2014, 15:48    Post subject:  

Hi Toni,

Quote:
Just for information I'm experimenting with mjwm menu and I think I will include it as third menu method in Jwm version.


Looks promising!
It's a pity that Terry is not around these days to possibly support or upgrade his applications.
If I remember well you wrote sometime ago to send PM to him, you got no reply?

Fred
Back to top
View user's profile Send private message 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Sat 20 Dec 2014, 16:14    Post subject:  

Hi, Fred.

I got reply from Terry, but he was too busy with personal problems. I'm sure he will write when he has time to help.

I like mjwm a lot. It will be included with sure as System -> Menu-MJWM option. Need some more testing and exploring how to get icons for categories and some other things.

Edit: Using puppy.mjwm default configuration looks better, but will be nice if Others category has icon also.
mjwm.jpg
 Description   
 Filesize   46.84 KB
 Viewed   379 Time(s)

mjwm.jpg

mjwm-menu.jpg
 Description   
 Filesize   47.96 KB
 Viewed   380 Time(s)

mjwm-menu.jpg

Back to top
View user's profile Send private message MSN Messenger 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Sat 20 Dec 2014, 17:20    Post subject:  

fredx181 wrote:
Forgot to set $ret variable (ret=$?) after commands.
Attached fixed: shutdown-pass-activate_deactivate.tar.gz

Hi, Fred.

Can you check this new file. I think it is the same as the old one and has the same issue.

Edit: To explain better here is what happens on Jwm version after installing latest gsu and starting shutdown-pass-activate_deactivate as user puppy:
First run I use Cancel button on gsu window and get this message on the attached picture: "Puppy user added to group wheel." But it is not added:
Code:
puppy@debian:~$ id -nG puppy
puppy cdrom sudo audio video fuse

Second run I chose to add it and confirm typing the password in gsu window. All is fine and puppy is added to group wheel:
Code:
puppy@debian:~$ id -nG puppy
puppy cdrom sudo audio video fuse wheel

From this point every time I use shutdown-pass-activate_deactivate I do not get anymore gsu window and puppy is added/removed without showing up gsu window anymore. Note this happens even if I do not logout and login and the changes from adding puppy to group wheel should not be activated yet. But logout and login does not change the missing gsu window. I think it has to show gsu window every time running shutdown-pass-activate_deactivate. Even when puppy is already added to group wheel. This is the content of /etc/sudoers:
Code:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
%wheel ALL= NOPASSWD: /sbin/shutdown, /sbin/reboot, /sbin/poweroff, /usr/bin/wmpoweroff, /usr/bin/wmreboot, /usr/bin/save2flash

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d


Edit2: Changing latest gsu to gsu-xterm makes gsu window to show up as it should each time running shutdown-pass-activate_deactivate.
The problems I see at this moment:

1. shutdown-pass-activate_deactivate should not give false message on first run "puppy is added to group wheel" when it is not actually added.
2. Latest gsu-yad does not act as gsu-xterm and makes possible to run commands with gsu line without password confirmation (atleast for shutdown password activate/deactivate). It should not skip the password prompt if the exact NOPASSWD command is not added in wheel line in /etc/sudoers and user added to group wheel, logout and login back.

Edit3: I guess "sudo -S" in gsu is the reason gsu does not show up second time but I'm not sure yet. If it is so, Fred, I do not like this as default gsu setup for Jwm version. I prefer prompt for password each time when gsu is called. NOPASSWD should be set only from /etc/sudoers. I will test it more when I get mjwm working right. Maybe it is not something in gsu but other reason.

Toni
yad-message.jpg
 Description   
 Filesize   13 KB
 Viewed   341 Time(s)

yad-message.jpg

Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Sun 21 Dec 2014, 15:05    Post subject:  

Hi Toni,

Quote:
The problems I see at this moment:

1. shutdown-pass-activate_deactivate should not give false message on first run "puppy is added to group wheel" when it is not actually added.
2. Latest gsu-yad does not act as gsu-xterm and makes possible to run commands with gsu line without password confirmation (atleast for shutdown password activate/deactivate). It should not skip the password prompt if the exact NOPASSWD command is not added in wheel line in /etc/sudoers and user added to group wheel, logout and login back.


1. I cannot reproduce this at the moment, does this happen for you after rebooting also?
Btw, how you define "logout and login back in" ? Exit X and startx doesn't do that, I think.
2. This is complicated stuff, there's also the default timeout for giving password for sudo (from what I read it is 5 minutes). I don't think that the gsu script includes some hack to avoid entering password (so that's why I guess it has to do with some default behaviour of sudo, I'm still testing to find out what and how)
Also this I found when running for example apt2sfs:
Code:
puppy@dog:/$ sudo apt2sfs
[sudo] password for puppy:
puppy@dog:/$ sudo apt2sfs
puppy@dog:/$

When running from same terminal second time it doesn't ask for password.
Then when opening new terminal and run "sudo apt2sfs" again password is required.
Then when running from menu it doesn't ask for password.

Edit: correction: when running second time from menu it doesn't ask for password.

Maybe removing this section from /opt/bin/gsu makes it behave like xterm-gsu:
Code:
    # check for sudo
    sudo_check=$(sudo -H -S -- echo SUDO_OK 2>&1 &)
    if [[ $sudo_check == "SUDO_OK" ]]; then
        exec_command=$(eval sudo $cmd 2>&1 &)
OUTPUT=$(echo $exec_command | grep -o "command not found")

if [ "$OUTPUT" = "command not found" ]; then
yad --text="    Sorry, could not find command:     \n    '$cmd' .  \n     Please try again. " --button="gtk-close:0"
fi
        exit $?
    fi

But as I said still needs testing and honestly I'm confused about how these things work.
Maybe the thing to test after we possibly give up yad-gsu is ktsuss-sudo and if that gives problems also, we better use the xterm-gsu.
I think the xterm-gsu asks for password every time because new terminal is executed.

Maybe you did already but I'll test also how gksu behaves with timeout etc..

Edit:
Quote:
1. I cannot reproduce this at the moment, does this happen for you after rebooting also?

Can reproduce it now, can't figure out why yet, I'll look at it.

Fred

Last edited by fredx181 on Sun 21 Dec 2014, 16:24; edited 1 time in total
Back to top
View user's profile Send private message 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Sun 21 Dec 2014, 16:19    Post subject:  

Hi, Fred.
Take your time. I just share what I see as potential problems from testing.
fredx181 wrote:

Btw, how you define "logout and login back in" ? Exit X and startx doesn't do that, I think.

With XDM activated even Ctrl+Alt+BackSpase drops out to login prompt.
Without XDM -> Shutdown -> Exit WM:
Code:
exit
login
puppy
puppy
startx

Quote:
...honestly I'm confused about how these things work.

Me too, Fred, I will do more testing with sudo and gksu and gsu. I remeber I had troubles with permissions in Jwm version with ktsuss-gsu but I will test it again.

Standard Debian Gnome asks for password only first time starting gksu if I do not mistake. Then it does not ask for password anymore.
I know in the same terminal sudo does not ask for password second time. This why I wrote it might be not gsu problem.
Still I do not like surprises like removing by accident user from group wheel just because for some reason password prompt is not active. Atleast I like to know why this happens.
We have much work to do for the next version, but lets keep it for later - after New Year.

Toni

_________________
Farewell, Nooby, you will be missed...
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Sun 21 Dec 2014, 17:28    Post subject:  

Hi Toni,

Quote:
Take your time. I just share what I see as potential problems from testing.


Yes, and thanks for testing.
I see it as my responsibility because I like to include the graphical sudo Smile

Quote:
Still I do not like surprises like removing by accident user from group wheel just because for some reason password prompt is not active. Atleast I like to know why this happens.


I assume you refer to this you wrote earlier:
Quote:
First run I use Cancel button on gsu window and get this message on the attached picture: "Puppy user added to group wheel." But it is not added:


I found the reason for it is mistake in gsu script, on line 28 instead of:
Code:
[[ $ret -ne 0 ]] && exit 0

It should be:
Code:
[[ $ret -ne 0 ]] && exit 1

The shutdown-pass-activate_deactivate script gets $ret value from it, that's why it gives message 'succeeded' (exit 0), when canceled it should read $ret value as 1 (exit 1)

Attached new gsu with correction and:
"gsu-notimeout" from which I deleted the "check for sudo" part and also added "sudo -K" command (it should disable timeout for password, so this way every time entering password is required).
I see the "timeout" for password as a feature which is enabled by default for some time (still don't know how long, I read different things about it on documentation on the net, if it's 5 minutes or 15 minutes, didn't yet have the patience to test Smile )
Or maybe it is valid for the whole login session.

Fred
gsu_gsu-notimeout.tar.gz
Description  Fixed gsu and gsu-notimeout scripts.
gz

 Download 
Filename  gsu_gsu-notimeout.tar.gz 
Filesize  699 Bytes 
Downloaded  112 Time(s) 
Back to top
View user's profile Send private message 
saintless


Joined: 11 Jun 2011
Posts: 3882
Location: Bulgaria

PostPosted: Mon 22 Dec 2014, 04:33    Post subject:  

Thanks, Fred Wink

I confirm it is working and I vote for gsu-notimeout as default.
We can include both in gsu package if you like:
gsu (renamed from gsu-notimeout)
gsu-timeout (or other name for the other gsu).
Then the user can easy switch the names in /opt/bin if needed without having troubles to uninstall/reinstall gsu package later.

From what I read gksu, gsudo, ktsuss should be used inside /usr/share/application desktop files or /usr/share/menu if the user decides to run applications as root or to skip typing sudo in terminal for programs in /sbin, /usr/sbin. And I think most of the posts describe this as not recommended.

I think the packages in debian repository are made by default for multiuser use and the solution they use is not sudo or gksu, but the program write only in $HOME/ and it is started from PATH available as default for user account (like /usr/bin, /usre/local/bin, /bin).

In DebianDog we use different method from the start adding gsu line for almost every script.
William for example makes the packages work without gsu line (ffconvert, precord, pavrecord, domyfile, domycommand).
I don't say to skip gsu line inside scripts in the future, but we can hope the user will use them careful after having password prompt every time starting the program.
For example latest apt2sfs can easy break the system without reading how to use it properly. If I cancel the proces installing packages in the middle or after, I have few seconds interval before the message "Trying to recover dpkg databse" appears. I can easy reboot or logout for these few seconds or just to ignore the message and reboot. Or maybe pawer failure could happen. Then status file is broken.
The first apt2sfs without installing packages or the later (without copying status from main module) were not smart, but safe.
All I mean is we should have password prompt every time gsu script is called hoping this will make the user more careful with scripts containing gsu line.

I hope this makes sense Smile

BTW just for information we have available different GUI with root password prompt (su-to-root -X -c command-name). For example Gparted /usr/share/menu file is started this way by default:
Code:
?package(gparted):\
   needs="X11"\
   section="Applications/System/Administration"\
   title="GNOME partition editor"\
   command="su-to-root -X -c /usr/sbin/gparted"\
   icon="/usr/share/pixmaps/gparted.xpm"

Picture attached.

Happy Holidays!
su-to-root.jpg
 Description   
 Filesize   19.37 KB
 Viewed   268 Time(s)

su-to-root.jpg


_________________
Farewell, Nooby, you will be missed...
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Mon 22 Dec 2014, 16:14    Post subject:  

Hi Toni,

Quote:
We can include both in gsu package if you like:
gsu (renamed from gsu-notimeout)
gsu-timeout (or other name for the other gsu).
Then the user can easy switch the names in /opt/bin if needed without having troubles to uninstall/reinstall gsu package later.


Yes, it's fine by me this way.

Quote:
.....
.....
I hope this makes sense Smile


It surely does.

Quote:
BTW just for information we have available different GUI with root password prompt (su-to-root -X -c command-name). For example Gparted /usr/share/menu file is started this way by default:

The GUI you see is just the same as ktsuss.
The su-to-root script checks for 'which ktsuss' and use it if any other (like gksu or kdesu) is not available Wink

Quote:
Happy Holidays!


Thanks, same to you Toni!
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 2529
Location: holland

PostPosted: Tue 23 Dec 2014, 08:35    Post subject: yad-splash (similar to gtkdialog-splash)  

Hi All,

Here's a script using yad that does a similar thing as gtkdialog-splash. (It's much more simple though)
.
Started this to make it possible to show a nicer colored splash message in scripts that use yad as frontend.
(don't like mixing it with gtkdialog-splash)
All yad parameters can be used plus a few additions (foreground, background, fontname)
For usage type: yad-splash --help

Some examples: (see also pictures)
Example1:
Code:
./yad-splash --image browser-dload --image-on-top --bg '#F4E48F' --text "  Downloading...  " --undecorated --no-buttons &


Example2:
Code:
./yad-splash --borders 5  --text "    Virus detected! \n Name is: Window$  \n \n    Remove it?" --fontname "Bold 18" --bg "dark red" --fg "yellow" --undecorated --button="gtk-yes:0" &


Attached: yad-splash.tar.gz

Edit: To show what's more possible here's another example (more complicated, using <span ...>)
Example3:
Code:
./yad-splash --borders 5  --text "<span size='large' foreground='#432424'><b> All updates are done.  </b></span> \n <span foreground='dark red'><b> A reboot is required. \n      Reboot now?  </b></span>" --bg '#F4E48F' --fg '#7B2365' --undecorated &

This makes the buttons font different color as the text.

Fred
example3.png
 Description   Eample3
 Filesize   9.56 KB
 Viewed   172 Time(s)

example3.png

example1.png
 Description   Example1
 Filesize   5.88 KB
 Viewed   189 Time(s)

example1.png

example2.png
 Description   Example2
 Filesize   10.02 KB
 Viewed   194 Time(s)

example2.png

yad-splash.tar.gz
Description  yad-splash
gz

 Download 
Filename  yad-splash.tar.gz 
Filesize  903 Bytes 
Downloaded  113 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 271 of 283 [4236 Posts]   Goto page: Previous 1, 2, 3, ..., 269, 270, 271, 272, 273, ..., 281, 282, 283 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Derivatives
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1150s ][ Queries: 13 (0.0397s) ][ GZIP on ]