Does anyone ever use the Sudo Command on Terminal?

Discussion in 'macOS' started by Twe Foju, Jan 22, 2008.

  1. Twe Foju macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #1
    ok,so here's how it happened,

    i just bought my MBP on 27 dec, around like a month ago

    and you get this registration form at the beginning of the setup right? at that time, my MBP is still using 10.4.10 ( so basically it's tiger ) and i did the registration form ( its done and sent )

    the next morning, i tried to install the Leopard which comes in the box, and after i did, the same setup was asked for us to fill it in right, ( the registration form stuffs ) but the internet was down at that time, so i thought i can cancel the registration form and do it when the internet backs up, because usually it can be located on our Home Folder, but then later, when the internet backs up, i wanted to do the form registration, but it's not there

    so some of the expert on MBP asked me to perform this command in the terminal "sudo rm -f /var/db/.AppleSetupDone"

    that command basically delete the history that we ever did the assistant register form and it took us back to the 1st setup, and it actually did, i was taken back to the welcome screen assistant right after i reboot, so it ends my curiosity at once

    only to realize later on, does performing such task can cause any harm to my MBP? or like downgrade performance?

    well, though there is no difference at performance task, ( still as fast as ever)
    just curious does it totally save to perform that sudo task?

    thanks

    and finally, does anyone know how to re-appear the warning that appear on the 1st time we're about to use the Sudo command?

    because now it's not appearing anymore, but i would love it to re-appear again, the warning, that is

    anyone here know how to? i know it can, but there is no way i can know how to except the experts here =)

    it will be greatly appreciated by me

    thanks alot! :)
     
  2. TBi macrumors 68030

    TBi

    Joined:
    Jul 26, 2005
    Location:
    Ireland
    #2
    Actually the task you ran was "rm" which basicially is the command line for delete (remove). All Sudo does is tell it to run as administrator (root user).

    It won't do anything bad to your computer
     
  3. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #3
    ok, good to hear that

    so how about the "how to make the warning re-appear" step?

    does anyone know how to re-appear the sudo warning ?

    i know it's not a big deal, because it sill ask us to type the password before the process,

    but i would really love to see the warning again just to make it feels default-ish :D
     
  4. Lord Sam macrumors regular

    Lord Sam

    #4
    Nope

    As mentioned, the rm command is the same as pressing the delete button, or command backspace. The sudoing is only required for tasks which require an extreme ammount of authority to execute. Your computer will not be damaged, unless the command line purposefully damages it. As far as I know, only erasing and re-installing terminal (or returning it to factory settings will do the trick.
    :)
     
  5. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #5
    hmm, ok, im relief now, because for a while, i thought i had messed up with my MBP system, pheww :D

    i'll skip the re-installing part

    how do i set it to factory default setting for the terminal?

    :)
     
  6. Lord Sam macrumors regular

    Lord Sam

    #6
    hrm...

    I'm not sure. Ive never felt compelled to try. I can play around with it and get back to you though. Sorry.
     
  7. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #7
    wow, do you mind?

    :):)

    i mean, it does not require scripting or stuffs like that right?
     
  8. Lord Sam macrumors regular

    Lord Sam

    #8
    Sorry

    I can't find the command in the GUI. There's probably a terminal command for it, ironicaly. I can ask a friend who might know tomoz. Again, sorry. :(
     
  9. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #9
    The warning about using the sudo command comes up essentially once per session for me, as in each time I restart or logout/in. After that, it assumes you read it the first time and doesn't bother displaying it again. Next time you restart, it'll be back the first time you try it.

    jW
     
  10. TheStu macrumors 65816

    Joined:
    Aug 20, 2006
    Location:
    Carlisle, PA
    #10
    Mine doesn't do that. I use sudo at least once a day (syslogd runaway process) and after that first use, it has never bugged me again.
     
  11. Lord Sam macrumors regular

    Lord Sam

    #11
    ame

    Same. Maybe it is a prefs thing? I have no idea why it would vary between user, maybe version updates?
     
  12. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #12
    hm, mine does not do that, and im sure almost all of the terminal users wont find the warning the 2nd time they use sudo,

    version update? im not sure, but i know the warning are meant to only show up once ( or if we did not use sudo command ) it will always appear

    ill be waiting for an answer, hopefully

    =)
     
  13. Mr.PS macrumors 6502a

    Joined:
    Jan 8, 2008
    #13
    sudo = su (switch user) and do (do it). It essentially just gives your current user root privileges to run a command that needs access to system files, or files owned by another user other then yours. Don't worry about it, just continue to use it when needed. :)
     
  14. dvd macrumors regular

    dvd

    Joined:
    Oct 12, 2007
    Location:
    Massachusetts
    #14
    sudo -K

    will cause the warning message to be printed the next time you run sudo
     
  15. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #15
    what does the -K does, if i might know? :)

    does it delete any specific reference files or it is just a command to make the warning re-appear?

    because im at college right now, i cant directly try it on my MBP since i left it at home

    thanks :)
     
  16. dvd macrumors regular

    dvd

    Joined:
    Oct 12, 2007
    Location:
    Massachusetts
    #16
    sudo -K is perfectly safe and won't mess anything up for you.

    When you run the sudo command and authenticate with the administrative password, sudo timestamps it and allows you to run additional commands in the same terminal window for a few (maybe 5?) minutes without re-asking for the password. If you type 'sudo -k' lowercase it forgets that recent timestamp and requires you to provide your password again upon next usage. The 'sudo -K' command takes it one step further and erases any timestamps associated with your user. The result is the next time you try and use sudo, it can't find any previous timestamps so it assumes you have never run sudo before and issues the warning.

    (Technically speaking, the "timestamp" is a directory entry in /var/db/sudo. The sudo -k command removes the directory associated with your short username.)
     
  17. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #17
    you mean in "/private/var/db/sudo/" ?

    so which one is better?

    using the sudo -K to remove the timestamp or remove the folder "/private/var/db/sudo/" ?
     
  18. Lord Sam macrumors regular

    Lord Sam

    #18
    The result is basically the same. Its just different methods of doing the same thing. Whatever works best for you. Neither of them do anything bad to your computer, and both of them work.:D
     
  19. dvd macrumors regular

    dvd

    Joined:
    Oct 12, 2007
    Location:
    Massachusetts
    #19
    yes, sorry, /private/var/db/sudo/ and /var/db/sudo/ are one in the same (they are symbolically linked)

    Practically speaking? six of one, half a dozen of the other on a Mac... it makes no difference. Theoretically speaking, you should use 'sudo -K' because it's implementation independent.. it will work on any platform that offers the sudo command, such as Linux, Solaris, *BSD, etc. For example, on my Linux box, the timestamp directory is /var/run/sudo instead. By using 'sudo -K' I wouldn't need to know or care. Removing the directory manually would be considered "tinkering under the hood."

    Type 'man sudo' from a terminal window to learn more about the sudo command if you want to go down the rabbit hole. ;-) You can also type 'man rm' to learn about the rm command, etc.
     
  20. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
  21. dvd macrumors regular

    dvd

    Joined:
    Oct 12, 2007
    Location:
    Massachusetts
    #21
    ahh yes, scorched earth.. not for the faint of heart..

    [​IMG]
     
  22. Twe Foju thread starter macrumors 6502

    Twe Foju

    Joined:
    Dec 20, 2007
    Location:
    Jakarta
    #22
    ok, i typed "sudo -K" and nothing happened?

    ---edit---

    ok, the warning shows up again, thanks alot guys!!
     

Share This Page