i need to execute the following commands AFTER login.   sudo hdparm -y /dev/disk/by-uuid/443AFBAD7FE50945  sudo hdparm -y /dev/disk/by-uuid/7ABB49654B799D40   (trying to edit rc.local does not work nor does using hdparm.conf because as soon as I log in the disks start up again). I have tried numerous things like bash files and autossh entries in the startup applications with no luck because sudo is involved.   i have tried the rc.local, the .bashrc, the autossh in startup, hdparm.conf. none of these options have worked
121930
I have made a sound based installation using OpenFrameworks and Puredata that runs on Ubuntu 12.10.  I need the installation to run continuously for days together. When the power goes off, i need the apps to start automatically on reboot.  My problem is, I have got everything installed in the root account because that is how few of them would run. So i need the system to run those programs as root without asking for a password.  Somehow it sounds very silly to me but I guess there must be a way to do this.  Any help/pointers are appreciated. Thank you
6351
I need to run a bash script at boot-time as superuser in Xubuntu. I don't know where to start. I have to do something described in a Arch Linux guide. That guide says exactly:     Add following at the end of the file : /etc/rc.sysinit   # Do my action /etc/rc.d/do_my_action  /bin/dmesg &gt;| /var/log/dmesg.log   But I do not have /etc/rc.sysinit and /etc/rc.d/ in Xubuntu. I'm sure there are equivalent ones, right?
77228
when I try using a command with sudo everything works fine, however, if I want to log in as the superuser using su it doesn't let me. Why?
44810
For whatever reason, we do no longer need to be root (or using sudo) to run /sbin/shutdown, /sbin/reboot etc.  This seems to be because those executables are now symlinks to /bin/systemctl which handles everything as normal user.  However, what if I want shutdown and reboot to require root authentication again? How can I achieve this?
84008
I am trying to build an RPM that targets RHEL4 and 5. Right now I call chcon from %post but multiple Google entries say "that's not how you are supposed to do it" with very limited help on the right way. I've also noticed that fixfiles -R mypackage check says the files are wrong when they are right (as expected; the RPM DB doesn't realize what I want)..   I specifically say RHEL4 because it does not have semanage which seems to be one of the proper ways to do it. (Add a new policy and then run restorecon on your directories in %post.)   I also don't need my own context, just httpd_cache_t on a non-standard directory.  I have also seen "let cpio take care of it" - but then I have a new problem that a non-root RPM building user cannot run chcon on the build directories. I cheated and had sudo in the spec file but that didn't seem to matter anyway.
18626
I already read it from manual but I can't see difference..  su - change user ID or become superuser  sudo -s [command]   The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5).  If a                    command is specified, it is passed to the shell for execution.  Otherwise, an interactive shell is executed.  sudo -i disappear description in manual
106956
I'm using Linux Mint Cinnamon 19.  I've written a simple script     #!/bin/bash    #test    notify-send "text" "other text" -i dialog-warning   to notify me when it's executed. In order to run the script at the startup I've tried the following procedures. Both of them didn't work.  First using init.d directory        Made a simple bash script prova.sh and made it bootable with chmod command.    Copied to /etc/init.d/ directory.   Made a soft link to /etc/rc0.d/ directory.      Second using crontab        Executed the command crontab -e.   Added the following lines to the file:   @reboot /home/user/prova.sh   Executed the command update-rc.d cron defaults      Any advice?
49065
When I run sudo, what exactly happens to my environment?  When I run sudo command, it doesn't seem to see my or root's environment. For example, my path for both includes /usr/local/bin, but if I try to run one of the program's without the full path, it fails.  I thought sudo ran as root, and hence got root`s environment. Is there a different way that bash executes under sudo than under root or my normal user?  EDIT:  I have been using sudo -i lately, but recently it has been causing problems because my current working directory gets set to /root. This is as expected (sorta), but I still don't understand why sudo isn't recognizing my executables in /usr/local/bin.  EDIT:  I am running Fedora 15.
79626
I'd like to run a privileged command upon successful SSH logins at the server's end. However, this has to be in the server configuration (sshd_config or anything else that cannot be manipulated or circumvented by the user) as I need this to be mandatory. That is, however restricted the system account used is, it needs to be able to manipulate a piece of data that requires superuser privileges (namely use ipset add conditionally - which I can script). Oh and I'd like to be able to access the contents of SSH_CLIENT, please - despite privileged execution. The command also must be unaffected by ChrootDirectory.  I am aware of /etc/ssh/sshrc, but that appears to be "client-side", i.e. it's being run by the user who is logging into the machine.  Does such a facility exist in OpenSSH? I am using version 6.6.    Also, the man page (ssh(1)) isn't all too clear about sshrc:     /etc/ssh/sshrc   Commands in this file are executed by ssh when the user logs in, just before the user's   shell (or command) is started.  See the sshd(8) manual page for more information.   So does this mean it also runs whenever external commands (via ForceCommand) or subsystems like internal-sftp get invoked, despite restricting settings like PTY allocation or forcing a chroot? If so, I could resort to a restrictive /etc/sudoers entry if there is no other way at all.  NB: I am not using inetd for obvious reasons (see sshd(8)) as described .
273
I'd like to run a command at startup which pings a certain address every 10 minutes and writes the result to a file. I've figured out now how to do the pinging and file writing and the 10 min intervals:  while true; do my-command-here; sleep 600; done   My question is, can I put this in /etc/init.d/rc.local or should I be putting it in /etc/rc.local or somewhere else entirely? I'm specifically concerned because it's an infinite loop so I'm not sure if I could put it in one of these startup scripts.  Some help would be appreciated. I'm using Ubuntu 12.04.5
75804
How do I create a system-wide autostart file?  This would be on a cloud server running the desktop version of Maverick.  I logged in as root and created an autostart file using System/Preferences/StartupApplications but it ended up in /root/.config/autostart and did not execute (as far as I can tell) upon rebooting.  The autostart file is to invoke a bash script that invokes the VNC server.    I copied the .desktop autostart file from /root/.config/autostart to /etc/xdg/autostart and rebooted.  This did not seem to make a difference.  Edit As mentioned in a comment, the objective is to run my bash script which starts the VNC server upon boot; not upon a login.
100990
I am trying to run a detached screen under a specific user in rc.local on boot. The code below is what I have so far, but it is not working for me. The su part seems to be giving me an error.  su - username -c /usr/bin/screen -dmS test bash -c '/var/www/path/to/script/script.sh; exec bash'
120770
The output of the above command when passed through echo is:  # echo systemctl\ {restart,status}\ sshd\; systemctl restart sshd; systemctl status sshd;   Even if I paste the output to the terminal, the command works. But when I try to directly run the command, I get:  # systemctl\ {restart,status}\ sshd\; bash: systemctl restart sshd;: command not found...   I have two questions..   What exactly is this method of substitution and expansion called? (So that I can research it and learn more about it and how to use it properly).  What did I do wrong here? Why doesn't it work?
25959
For example, I'm trying to run Archive Manager from Ubuntu Desktop (10.04) under sudo otherwise it won't let me extract a Software Development Kit into /usr/local  Update: I don't want sudo to be a permanent change to launching the application; only to run it under sudo when I choose, until it's quit.
36763
I have messed up my sudoers file and I want to change the permission on it.   When I login in recovery mode, I cannot run the command chmod as it is read-only option.  I tried mount -o remount,rw / in recovery mode. Didn't work for me:  Err : Ext4-fs remount. Opts errors=remount-ro    How can I boot into recovery mode and with read-write option?
93268
I was doing some experiment about resource-accessing. By mistake, I executed this command, $ sudo mv /etc/passwd /etc/passwd.bak Then I could not execute any command with privilege(eg. sudo mv /etc/passwd.bak /etc/passwd). When I shut the system down, I could not boot it any more. Afterwards, I restored the passwd file with a LiveCD.  Any other approaches could make it?
98060
Can anybody let me know how to execute sudo commands with expect? I tried the following but this is not working. Can anyone give me suggestion please?  set login "sasuke" set addr "hostname" set pw "mypasswd" spawn ssh $login@$addr expect "$login@$addr\'s password:" send "$pw\r" expect "#" send "output=$(sudo virsh list --all | awk "/running/{print \$2}" | tail -2); sudo virsh dominfo $output" expect "password:" send "$pw\r" expect "#"   When I tried the below script, it executed without errors, but I didn't get the output. Here is the script and the output when it executes. Where am I making a mistake here?  set login "sasuke" set addr "hostname" set pw "mypasswd" spawn ssh $login@$addr expect "$login@$addr's password:" send "$pw\r" expect "#" send {output=$(sudo virsh list --all | awk '/running/{print $2}' | tail -2)} expect {     password: {send "$pw\r"; exp_continue}     "#" } send {sudo virsh dominfo "$output"}    ;# don't know if you need quotes there expect {     password: {send "$pw\r"; exp_continue}     "#" }   Execution  sasuke@njob:~$ ./hypr.sh  spawn ssh sasuke@hostname  sasuke@hostname's password:  sasuke@hostname:~$ output=$(sudo virsh list --all | awk '/running/{print $2}' | tail -10)sudo virsh dominfo '$output' sasuke@njob:~$