Programming :: Sudo In Shell Script \ Ask For The Password Then Execute The Script At Background And Get Back To Menu?

May 27, 2011

Whats wrong with this line?Code:sudo -u user /usr/bin/nohup sh /home/user/somescript.sh &This should ask for the password then execute the script at background and get back to menu

View 8 Replies


ADVERTISEMENT

Debian :: Autologin And Update / Without The Password(s) / Su/sudo To Execute?

Oct 28, 2010

I have succesfully installed Debian with gnome-core, iceweasel and other useful packages and also followed this guide to autologin and start X. I noticed that the sudo chmod +s /sbin/halt and adding /sbin/halt
in ~/.bashrc made Debian refuse me to log out (from X) and 'log out' turns off the computer insted.Removing /sbin/halt from .bashrc turned everything to as i want it. Should I "repair" or remove something I created with chmod +s command or should I leave it as it is?

Also I would like apt-get(or aptitude) update to run after login (and before startx), so i added sudo apt-get update to .bashrc but it will prompt me with password. Is there someway I could do this without the password(s) which su/sudo needs to execute? This is not so important but it would be very nice to update the system on startup.

View 5 Replies View Related

Programming :: Get Background Jobs To Execute Sequentially?

May 4, 2009

I'm looking for a general pointer, or label for what I am trying to do. Not a specific line of code. I've written a couple of small sh script that gets some user input, then calls several programs to run in the background with the &. My problem is, they all run at the same time. Is there some way to get these jobs to run sequentially rather than consecutively? If yes, what is this process called? I'm thinking there should be a way to line up background jobs in a job queue, similar to how a print queue works, one job at a time. After searching for a couple of hours, I'm thinking there must be a name for this, but I don't know what it is.

View 11 Replies View Related

Software :: Execute Shell Commands That Require Root Password From PHP?

Jun 26, 2010

php. I am developing a web-interface for an application that sometimes needs root privs. Editting /etc/sudoers is not an option since the web interface needs to be portable to other users when they install my application. Is there any workaround ?PHP Code:

php code:$command = "./script.sh /dev/$DISKNAME &";$shellOutput = shell_exec($command); 
Code:

[code]...

View 2 Replies View Related

Programming :: Shell Can't Execute Through Ssh But Local Well?

Jan 10, 2010

The two host one is Aix 5.3 and another is Suse 10sp2 the both have the same script which including the following parts:

if [ `date +%a` = "Mon" ];then
if [ "$RESULT" = "" ]; then
echo "The `hostname` $DATE ok"

[code]...

View 1 Replies View Related

Programming :: Parallel Shell Scripts To Execute Using LAM?

May 29, 2011

i want to know whether we can write a shell script which can utilize 2 CPU's of a cluster...I heard its possible through C Shell [URL] But im familiar with bourne shell only....So is there a possibility to write Parallel Scripts.

View 5 Replies View Related

Programming :: Unable To Execute FOR Loop In Shell?

Apr 19, 2011

hint me why and how to execute the below for loop, the way i am trying to?

[bkcreddy17@local:~]$ cat -n test
1 date
2 ls -l

[code]...

View 14 Replies View Related

Programming :: Unable To Execute A 4GE File In Ksh Shell ?

Apr 7, 2010

I am trying to execute a 4GE file using command something like this "/usr/bin/ksh path of the file with some arguments " ex: /usr/bin/ksh /home/abc.4ge S "./xyz" . I am able to execute the 4GE without this "/usr/bin/ksh" specifying in the command which basically runs in ksh shell itself. But when i try to run it exclusively using the path of the shell it gives me an error something like this "/usr/bin/ksh: /home/abc.4ge: cannot execute". I did check the permissions and all the file has execute permission.

View 7 Replies View Related

Programming :: Getting Shell Script To Execute IF New Row In Postgres SQL Is Added?

Mar 17, 2009

I do not want to use cron.I want it to be instantaneous. I am working on a web server where the hosts turned-on safe mode and turned off a-lot of the functions for PHP (including exec) in order to secure their servers. Outside of that, I do have access to chroot and can pretty much do anything on the server. I want to use ImageMagick to create dynamic images based on form data.

I was trying to find a work-around with PHP where I can still use ImageMagick (a shell-based imagining program) by causing SQL to execute a shell script after the form data is saved to a table. Is there anyway it could cause a flag to automatically run a shell script when someone adds a new row to a certain table. It has to be instantaneous, more or less, so that the user isn't sitting there waiting for a minute for cron to catch any changes to the database.

View 1 Replies View Related

Programming :: Execute A Shell Script (with Source Command)?

Nov 19, 2010

This is weird. I have a shell script with no execute rights.$ chmod -x test.shThen I try$ test.shwhich does not work. (I have "." in PATH)When I do$ . test.shit works! I can run the script even though I have no execute rights. Why is that?Another question: If I have a shell script without a hash bang, I still can execute the shell script. Why? What does hash bang do? If there is no hash bang, why is the shell script run? What does the hash bang do

View 9 Replies View Related

Programming :: Shell Script To Execute Oracle Procedure

Jul 19, 2010

I am writing shell script for executing oracle procedure. Shell script need to take 3 parameters from one data file rest of the parameters need to pass in command line it self. Total 7 parameters are need to pass for shell script.1st,3rd,5th parameters need to take from dat file and rest of 4 parameters from command line.

Below is one oracle procedure:
EXEC CIM_MGMT_INSTALL.addFlow('$1','1.0','$1','Settings','$2','ECCD2',NULL,1);
$1is 1st and 3rd both places need to pass same parameter.$1,$2 need to take from data file as earlier says.

View 2 Replies View Related

General :: Getting Back From Password Protected Grub Menu To Default One?

Jun 7, 2010

Well here's what I've done in grub.confpassword --md5 BLABLABLA /grub/admin_menu.lstNow that I enter some password, I can go to that menu and run my pvt. OS.But how to get back to original (or say public or default) grub menu?

View 1 Replies View Related

Programming :: Prevent "leak" Into Shell From A Customized Shell Menu Script?

Dec 15, 2009

I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.

View 11 Replies View Related

Programming :: Automate The Password Prompt Required For Sudo Commands?

May 31, 2011

I have written a script to run commands on remote servers, it is working fine. But when I am running "sudo commands" on the remote servers, it asks for me password after prompting for ssh password. I am unable to automate this password prompt (which is just after ssh password prompt). This is the function I am using to provide passwords

Code:

pass ()
{
cd $DIR/"$dt1"_"$dt"
/usr/bin/perl << 'EOF'
use strict;

[code]....

I want the same function to be used , when it expects for sudo passwords for any of the below lines:

Code:

[sudo] password for vikas: orPassword: This is my "cmd" file passed in pass () function.

Code:

ssh -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 192.168.1.100 "bash rcmds"

This is my script output

Quote:

[vikas@box1 ~]$ ./rscript.sh
++ rm -rf /home/vikas/May_31
++ mkdir -p /home/vikas/May_31
++ set +x

[code]....

how to automate the password prompt required for sudo commands.

View 8 Replies View Related

Programming :: Bash Scripting With Sudo / Password Prompt And Accepting User Input?

Jul 30, 2011

I'm creating a bash script to do some tasks for me. I would like the script to be run at a set time of everyday. My first question is if it is possible that if one of the commands in the script requires sudo, is there a way to get around it with out making sudo not require a password. Such as, is there a way to include the password in the script? If that is the case, I can always just set the file as read only by sudo. I've been looking for a way to do this, with no success. if I have a command that wants input, how do I give it to the program. For example, if I want to make a zip file that is encrypted, the command would go as:

Code:

zip -r example * -e

now how would I get the script to insert my wanted password.

View 14 Replies View Related

Debian :: Sudo Apachectl Will Not Execute?

Oct 1, 2010

I finally got my path to save so apachectl is in my path. I can execute apachectl start as a regular user, although the server wont start because there is some sort of lock. When I sudo apachectl start , I get sudo: apachectl:command not found. My visudo file looks like this:Defaults env_keep += "PATH"

User_AliasOWnER=blake
root All=(ALL) ALL
OWNER ALL= NOPASSWD:ALL

View 14 Replies View Related

OpenSUSE :: Can't Execute Some Command With Sudo?

Nov 29, 2010

I would like to have an user that can execute al command with sudo.I configured sudo with yast2 and in the sudoers file actually there is a line with:USER ALL = (ALL) ALLWhere user is my username.But I can't use some command like ifconfig becouse it say that it can't find the command. I think that this is becouse of path, but shouldn't i get root path using sudo?

View 3 Replies View Related

General :: Execute A Command After Sudo?

May 4, 2011

I am working in a CentOS environment with numerous CentOS machines. Currently there are multiple developers that each have their own login/home directory and then for various admin tasks we all share a single super user account.

The problem

I have a number of aliases, variables, functions, and settings that exist in my personal login's .bash_profile. None of these are available in the shared super user's .bash_profile. My current work around is that everytime I sudo in as the super user and I re-execute my .bash_profile from my personal user's home directory. I am not allowed to edit the init stuff for the super user

The Question

Is there any way I can automate my sudo sequence such that it will execute my personal .bash_profile after I've executed sudo without requiring me to edit the super user's bash init stuff?

View 3 Replies View Related

Slackware :: Cant Execute File In /bin With Sudo?

Dec 28, 2010

I've created a firewall with iptables rules and saved them into my bin directory (then changed them to executable) However i cant use "sudo firewall-start" it just prints a whole heap of garbage. When i use the "sudo firewall-start" command as root, it works perfectly. Im sure there's a simple solution to this problem, but cant seem to find one in the forums.

View 5 Replies View Related

Ubuntu :: Sudo And Login Password Recognized - Password Box Does Not Like

Apr 27, 2010

I needed to use Synaptic Package Manager to install an app, but the dialog box ("enter the Administrative Password") that pops up before you can use Synaptic doesn't recognize my password ("incorrect password). I tried typing it into a text editor and it's spelled right, caps lock not turned on or anything.

In Terminal, sudo recognizes it, and it is recognized when I log into Ubuntu. I'm the sole user, I have admin privileges, I've been doing admin things.

I just now did System > Administration > Users and Groups and got a dialog box saying

"Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See [URL] for information. (Details - 1: Server ping error: IDLmg.org/CORBA/COMM_FAILURE:1.0)"

Moving past that, I changed my user password, and Ubuntu authenticated it.

How do you launch Synaptic Package Manager from the command line?

View 4 Replies View Related

General :: Execute Root Command Without Sudo?

Jan 24, 2010

On my ubuntu I have a command pm-suspend, which puts the computer to sleep. It has to be run with sudo. Since it is inconvenient to be forced to type the password every time I want my computer to sleep, I thought maybe there's a way around it. Naively I thought that if I'd create a script as root, that invokes pm-suspend, and then let anyone execute that script, I could run that script as my own user and then that script would be considered run by root and hence be allowed to run pm-suspend. Obviously that didn't work. The root-check procedure in pm-suspend still found out that the original executor was someone different from root.

Still I think something similar (although slightly more elaborate) should work.I'm thinking about the process that allows the user to mount hard drives for example. Normally root is required, but it is somehow bypassed by the gnome utility mounting.

View 8 Replies View Related

General :: How To Allow User To Execute All Commands Without Sudo

Apr 30, 2010

Customer asked me to create a menu for linux he also asked me to do this: Open like a command like where a user can execute commands...so for this the users have sudo enabled. The code below works OK. But it has an issue when a command is executed but the command does not need sudo

Like for instance
Code:
cd /
sudo: cd: command not found

How can I allow a user to execute all commands when a command does not need sudo
Code:
echo -e "Press Control+C to finish"
#echo -e " "
while true;
do
read whichcmd?"Insert Command: "
sudo $whichcmd
done

View 3 Replies View Related

Ubuntu :: Login Password To Be Different Then SUDO Password?

Jun 25, 2010

Is it possible to have your login password t be different then your SUDO password. I did a search on sudo password- Almost every post has the term in it.

View 2 Replies View Related

Ubuntu :: Sudo - Disable Confirmation And Simply Execute Command

Aug 5, 2010

In Ubuntu, When I type sudo and hit enter, the new command will appear on the command line, instead of simply executing. This is different from other operating systems I've used, such as older ubuntu's, mac osx and debian. Is there a way of disabling this confirmation and having it simply execute the command?

View 3 Replies View Related

Ubuntu :: Allow A Specific Group On Machine To Execute One Command With Sudo?

Aug 22, 2011

I'm trying to allow a specific group on my machine to execute one command with sudo without requiring a password, so what I want to do is add something like this to sudoers:

%groupName ALL = (ALL) NOPASSWD: /bin/bash /path/to/shfile.sh argument1 argument2

argument1 needs to be a url : http://subdomain1.subdomain2.domain.com

argument2 needs to be a path of the form /var/www/demo/SomeFolder/application/config/config.php

How do I put in a regex form that sudoers will understand ? I tried reading the sudoers manual, but it didn't help a lot .

View 1 Replies View Related

General :: Setup A System To Allow Normal Users To Execute A Command Without Using Sudo?

Jan 5, 2011

I am trying to setup a system to allow normal users to execute a command without using sudo. Is this possible?

View 6 Replies View Related

General :: Can't Execute Commands As Sudo Nor Access Sudoers File In Mandriva 2010.1

Aug 16, 2010

since a recent upgrade to Mandriva 2010.1 I am not able to 'sudo' as administrator or when I use the 'root' password. I am the only user on this machine (Dell Inspiron 530S multi-booted with Window's Vista Home Premium, Ubuntu 10.4, and Mandriva 2010.1). I can get into the 'Manage Users' section of the control center by authenticating as 'root' but I can't access 'sudoers file' from command line.

View 4 Replies View Related

General :: Execute This On The Shell?

Mar 12, 2011

ill have this question on the test maybe : In dir00 directory create files year01.txt, year02, ...year05.txt with January calendar for 2001-2005 years in it.-i'm lost. i execute this : cat | cal 01 2001 > year01.txt

View 12 Replies View Related

Ubuntu :: How To Execute A Shell File

Jan 11, 2011

Ubuntu version 10.10File location inside a folder on DesktopFile extn : .shI need to run this file in terminal console, but what path to be given is the question.

View 5 Replies View Related

Ubuntu :: How To Execute Shell Script Using GUI

May 19, 2011

Before I re-installed ubuntu I could just double click a shell script and I got prompted to chose if I wanted to edit it or run it. Now it just opens it in gedit.How do I execute it using the GUI not the command?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved