Re: Starting programs as another user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Dotan Cohen <dotancohen@xxxxxxxxx>
Sent: Sun, Oct 09, 2005 at 05:17:51PM +0200
To For users of Fedora Core releases
Subject: Starting programs as another user


> In KDE, it is possible to add programs to the K menu that will be
> started as another user. However, each time I start a program fro the
> K menu as another user, it asks me for the user's password, with no
> option of storing it.
> 
> How can I get around this situation? I have tried to enter the user as
> user:password, but that just prevented it from working properly (as if
> I had entered an invalid user name). I would not mind making a
> system-wide setting that says "everything that user A tries to do in
> the name of user B, he can do without a password."
> 
> Dotan
> http://technology-sleuth.com/internet/index.php
> 
> 
> 
> ------------------------------
> 

Hello,

Try expect.

There's a script with the expect package which will create an expect
script with the username and password. You just have to add the command
name underneath.

Make that script executable. Put it somewhere in the path, for example
$Home/bin and add that script to the autostart kde menu.

The script will get executed by expect as if you are doing it from
the console. This will save you from adding the user to sudoers, which
ultimately opens some vulnerabilities.

I am inserting one script for your help...

======To Login As root=============
#!/usr/bin/expect -f
#
# Auto su - login. Keep it in a safe place.

set force_conservative 0  ;# set to 1 to force conservative mode even if
            		  ;# script wasn't run conservatively originally
if {$force_conservative} {
	set send_slow {1 .1}
	proc send {ignore arg} {
		sleep .1
		exp_send -s -- $arg
	}
}

set timeout -1
spawn su -
match_max 100000
sleep .1
expect -exact "Password: "
# Imitate like a human. Select the one you may want.
set send_human {.09 1.5 .7 .05 1.7}
#set send_human {.03 .5 .3 .03 .5}
stty noecho
# Set your password here.
send -h "The Password\r"
interact
stty echo
exit
========================================

HTH
-- 
vikram...
         ||||||||
         ||||||||
^^'''''^^||root||^^^'''''''^^
        // \\   ))
       //(( \\// \\
      // /\\ ||   \\
     || / )) ((    \\
-- 
Truth has always been found to promote the best interests of mankind...
- Percy Bysshe Shelley
-- 
 O
~|~
 =
Registered Linux User #285795


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux