Sudo commands without puting in .bashrc


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu Sudo commands without puting in .bashrc
# 1  
Old 12-06-2013
Sudo commands without puting in .bashrc

dear all,
When I start my laptop, I need to run one command
Code:
/etc/init.open-afs start

and it require sudo privilege.

The only solution which occur to me is to put this command in .bashrc. But then the trouble comes as everytime I open any new tab it ask for the sudo password, which is pretty much annoying.

Please let me know if there is any other way to excute this command w/o having this issue of providing the password again and again..

thanks in advance,
emily
# 2  
Old 12-06-2013
Depending on your startup system, you could place a "start" link to that script into one or more runlevel subdirectories (rcn.d) below /etc/init.d or /etc .
c.f. man runlevel
# 3  
Old 12-06-2013
Quote:
Originally Posted by RudiC
Depending on your startup system, you could place a "start" link to that script into one or more runlevel subdirectories (rcn.d) below /etc/init.d or /etc .
Dear RudiC,
Thanks for the reply..however, I wonder if I understood it well !!
putting it 'start link' is new for me..you want me to add some file name (rcn.d) in /etc/init.d..and how to make it 'start link' ..???

Greetings from Hamburg,
emily
# 4  
Old 12-06-2013
Excerpt from this machines /etc/rc3.d:
Code:
S80ntp -> ../init.d/ntp
S99acpi-support -> ../init.d/acpi-support

When the system is started in / switched to runlevel 3, all those Snn- links in rc3.d are scanned and the respective scripts are executed. Try to create a link, say, S99open-afs in the pertaining subdir and see what happens when booting.

EDIT: Sorry, be careful - just putting in that link and boot may be a bit lightheaded - read your system's docu first (man init etc., /etc/init.d/README etc.) and try it with a script that does nothing but output a line.
# 5  
Old 12-13-2013
startup or booting time if you want to run some command then you can also write in /etc/rc.local
# 6  
Old 01-06-2014
Create a config in the /etc/sudoers.d directory. Look at the sudoers file in the etc dir by examples. The tag you will need to put in there is NOPASSWD.

***Note*** word to the wize. Be careful this posses a big security risk on your system if used improperly.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Tracking what commands were executed after sudo to another user

All team members has sudo access to user "batch55". Need to track all the commands used by team members after sudo to "batch55". Using HP-UX and ksh shell in our environment. How can i acheive this? Thanks In Advance. (2 Replies)
Discussion started by: venkatababu
2 Replies

2. Shell Programming and Scripting

Remoting sudo commands & bypassing bashrc

What I want to do is not unique, except that our environment has a twist. I want to ssh to a remote server and issue a sudo command to run a script. This isn't working, but you'll get the gist.# ssh remotehost sudo -i -u oracle script.bashThe sudo to oracle is fine. The script.bash sets up the... (4 Replies)
Discussion started by: JustaDude
4 Replies

3. Shell Programming and Scripting

Ssh not supporting sudo and sqlplus commands

Hi Guys , I was facing an issue some thing like , I have to connect remote machine and should execute few commands over there , I am able to run some simple commands , but below commands are throws error like not found. eg : sudo su - username and sqlplus user/pwd@db , srvrmgr commands etc ... (8 Replies)
Discussion started by: chandini
8 Replies

4. Shell Programming and Scripting

How to run sudo commands under a script?

Hi, I am new to scripting. I am trying to write a script to ssh one remote machine and run a sudo command. ssh <hostname> sudo -S <command> < ~/pass.txt I am stored my password in pass.txt. I am getting error sudo: no tty present and no askpass program specified Please suggest me how can... (1 Reply)
Discussion started by: venkia9
1 Replies

5. AIX

track commands run as root after sudo

I'm looking for a way to track commands that are run as root after a user runs sudo su - root. I have a profile set up for root that will track the commands by userid but if we change the shell it only stores it in that shells history file. (2 Replies)
Discussion started by: toor13
2 Replies

6. UNIX for Advanced & Expert Users

sudo: blocking specific commands

Hello all, I manage some HP-UX 11.31 servers. I have some users that have sudo access. All of them belong to the 'sudoers' user group. Right now, sudo is configured as wide open: %sudoers ALL=(ALL) ALL We are using sudo mostly for auditing purposes - when a user wants to run a... (9 Replies)
Discussion started by: lupin..the..3rd
9 Replies

7. Programming

Using Commands over SSH using Sudo

Is there a way to transfer my sudo password via ssh so that I can copy files remotely and pass them locally, so: cat sudo-passwd-file|ssh -t user@10.7.0.180 'sudo find / -depth|cpio -oacv|gzip' > /path/to/dir/file.cpio.gz I am in the process of a creating a script. Everytime I try and just... (16 Replies)
Discussion started by: metallica1973
16 Replies

8. UNIX for Dummies Questions & Answers

sudo commands list

Hi, Can you please give me a list of commands executed through 'sudo' command, thank you. (1 Reply)
Discussion started by: Dev_Dev
1 Replies

9. AIX

Add sudo executable commands

Guy's I have sudo already installed in AIX , just I want to know how can I add for example the following commands to be executed by sudo by (appuser).. shutdown /usr/startapp.sh /usr/stopapp.sh (5 Replies)
Discussion started by: ITHelper
5 Replies

10. UNIX for Advanced & Expert Users

Logging all commands after a sudo su-

Hi there, It might seem tricky, I confess. We use sudo to allow people to initiate priviledged commands (but not all commands) on our Unix systems. To by pass this, some people initiate the sudo su - command ; The main issue is to 'know' what those people do when they gain root access.... (4 Replies)
Discussion started by: linuxmtl
4 Replies
Login or Register to Ask a Question