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

Kalamalka Kid
  • 3,224
  • 11
  • 33
  • 65
  • @hakermania i need to know of script AFTER login – – Kalamalka Kid Jun 13 '14 at 18:30
  • i have tried the second solution at this site http://askubuntu.com/questions/462143/where-are-the-startup-scripts-for-unity-desktop ------with no results. – Kalamalka Kid Jun 13 '14 at 19:57
  • i have tried the rc.local, the .bashrc, the autossh in startup, hdparm.conf. none of these options have worked – Kalamalka Kid Jun 13 '14 at 21:05
  • 1
    I added a (slightly changed) answer here: http://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). – Jacob Vlijm Jun 21 '14 at 10:41

1 Answers1

-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

mmm3743
  • 338
  • 1
  • 6
  • 18
  • 3
    NOT recommended way as the password will be stored in plain text. – hytromo Jun 13 '14 at 10:16
  • 1
    Your edit is also not a secure method -> https://stackoverflow.com/questions/14062002/is-the-internal-password-of-delphi-exe-secure (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 '14 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 '14 at 14:24
  • 1
    Tuknutx - also you would havfe to use http://www.jetbrains.com/decompiler/ – mmm3743 Jun 13 '14 at 14:33