Bash scriipt calling Konsole in Sudo Mode
All,
I'm running Kubuntu, so it is "Konsole", not "Terminal" on my box. I need a bash script that does the following:
Konsole sessions open at the start of any login on my computer. It's such a pain to have to manually do this every time I login. Ideally, for security, the command will be: Code:
bash /...path.../sudologin.sh mypass All help appreciated! Cheers! TBNK |
sounds like a lot to figure out, your side panel says you've been using Linux for at least 3 yrs now, what have you figured out so far, other then the steps of operation?
using a Konsole, or you can install a different terminal to work in so it does not kill that one while you're working on figuring out how to kill a current Konsole terminal. work out the steps in a cli then add to a script test, fix, repeat until you get it. one step at a time. somethink like this to kill kill kill the terminals Code:
ps ux | grep xfce4-terminal | xargs kill |
Quote:
Quote:
https://docs.kde.org/trunk5/en/appli...e-options.html Quote:
man sudo man sudoers man kill man pgrep man ps man killall |
Progress
Quote:
From what you are saying my script needs to say: Code:
curdir='$pwd;
Cheers! TBNK |
All,
On the Redhat and Suse flavors of Linux the cli cmd: Code:
kdesu konsole Code:
konsole -e "su -" Since I'm attempting the opening of multiple tabs, needing the ktabs.txt file, not sure where to put this command set, in the ktabs.txt file or before it? Cheers! TBNK |
It seems that other terminals are better than konsole nowadays. But with konsole,
Code:
#!/bin/sh |
Code
All,
The code I currently have is Bash Script: Code:
#! /bin/bash Code:
#! ktabs.txt file adding this to a custom application launcher to get around this, but if you know the way to store this command set for continued execution it would be nice. Out of curiosity I'm wondering if the "nohup" background run cmd will work? Cheers! TBNK |
The -e option should be the last item on the line.
|
I ran my code, both from a launcher and from an "F2" window piping to error file and got no errors, but also the 3 knosole sessions did not apprear, so there is something wrong with the code.
Cheers! TBNK |
Quote:
Thanks! Moving the -e to the end of the line, it now executes only I'm just only getting 2 tabs and none are in the sudo mode. Cheers! TBNK |
All,
OK found the issue with the 3rd tab in the ktabs.txt file but now wondering if the sudo cmd needs to be in that file at the end of each tab line, since none of the sessions are coming up "SUDO"? Cheers! TBNK |
Here is an example:
Code:
#!/bin/sh |
Quote:
Thanks, but didn't work! Still never logs to SUDO mode! Cheers! TBNK |
Quote:
I see in some HOWTOs that it's -c for a cmd instead of -e to execute, but my system runs the -e. My question then is should the -e be in the ktabs.txt file. And should that replace the: Code:
command=/usr/bin/sudo -i /bin/sh Code:
-e sudo su -u root -p mypass I'm seeing this is one of those: "Hold your mouth just right!" situations! He He! Cheers! TBNK |
Turbocapitalist,
Would it be that my script needs to call another script the uses a for loop to find each konsole tab and execute the "sudo su -u root -p mypass" cmd on each tab? Cheers! TBNK |
All times are GMT -5. The time now is 08:15 PM. |