0

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

4
  • @hakermania i need to know of script AFTER login – Jun 13, 2014 at 18:30
  • i have tried the second solution at this site askubuntu.com/questions/462143/… ------with no results. Jun 13, 2014 at 19:57
  • i have tried the rc.local, the .bashrc, the autossh in startup, hdparm.conf. none of these options have worked Jun 13, 2014 at 21:05
  • 1
    I added a (slightly changed) answer here: askubuntu.com/a/486304/72216 That really should work. To make it run multiple commands, simply add another command below the first (with the same indent). Jun 21, 2014 at 10:41

1 Answer 1

-1

You can do:

echo #password | sudo -S #commmand

Replace #password with your password and #command with a command you want to execute.

EDIT 1: More secure way that takes a little bit of time
1) Run: "sudo apt-get install monodevelop"
2) Download https://www.dropbox.com/s/6917qfhc6mwc9jw/MountVolumens.tar.gz
3) Extract it where ever you want
4) Open "MountVolumens.sln" with monodevelop
5) At line 24 replace #password with your password
6) At line 25 write down all the commands you want to execute
7) Press Ctrl + F8
8) At line 24 remove your password
9) Go to the folder where you extracted the files, than go to "MountVolumens/bin/Debug", and there you should see a file called MountVolumens.exe
10) Copy it where ever you want, and create a sh script that just says "cd #location && mono MountVolumens.exe", replace #location with "MountVolumens.exe" folder location

4
  • 3
    NOT recommended way as the password will be stored in plain text.
    – hytromo
    Jun 13, 2014 at 10:16
  • 1
    Your edit is also not a secure method -> stackoverflow.com/questions/14062002/… (same problem in C#) because the password is not encrypted (or obfuscated). So it is possible to find the password in the .exe file with a simple hex editor.
    – TuKsn
    Jun 13, 2014 at 12:34
  • Tuknutx - you are right. I could add an ecryption, but since no one is ever gonna be using this software, I won't bother.
    – mmm3743
    Jun 13, 2014 at 14:24
  • 1
    Tuknutx - also you would havfe to use jetbrains.com/decompiler
    – mmm3743
    Jun 13, 2014 at 14:33

Not the answer you're looking for? Browse other questions tagged .