31

Me trying to use Linux for first time:
Sudo node index.js
access denied
Sudo shutdown
access denied (noob)
Me: im going back to Windows now....

Comments
  • 2
    If i'm not mistaken it is poweroff that turns off the system
  • 7
    @gitpush 'poweroff' is not the right command, you should use 'shutdown now'
  • 0
    @LMtx I'm no linux expert, but whats the difference between both of them?
  • 0
    I always thought poweroff was like shutting down, but safely.

    Don't do 'stop'.
  • 2
    wasn't it "shutdown -h 0"?
  • 7
    @gitpush 'poweroff' used to force system to close, 'shutdown' starts the proces to finish tasks and close system. Nowdays many distros make 'poweroff' more polite but I still prefere 'shutdown now' command
  • 0
    @LMtx Thanks for the tip, guess I'll use that from now on, don't want any trouble.
    I also do 'reboot' which instantly reboot any alternative or its just the way to go?
  • 0
    Why not use the shutdown button of the desktop environment? It let you choose what kind of shutdown/reboot, just like windows.
    As long as the desktop environment is working there is no need to shut down the system from CLI. Or are we talking about a RasPi?
  • 1
    'shutdown +0' saves one character ;)
  • 2
    @gitpush 'reboot' is fine, I use 'shutdown -r now' but there is no difference
  • 0
    Use poweroff, halt or systemctl halt (systemd only).

    For node giving access denied..
    Well, ls your file to see perms, although I doubt that's it.

    Trial and error is probably the way to solve it.
    strace could provide some key insights into what's triggering it.
  • 1
    @ddephor servers do not have buttons ;)
  • 10
    Running your node js application as superuser is bad practice :)
  • 1
    sudo reboot, because sleep is for the weak.
  • 3
    Poweroff and reboot are now systemd ways to do it and are correct. I believe when you run reboot or shutdown now (the old way) it's just an alias to systemctl poweroff or systemctl reboot. Running init 0 or init 6 is simply an alias now as well. And actually I think the command is systemctl set-target poweroff. You can see all of these by running systemctl list-targets I believe.

    In systemctl, you have a target which is essentially a run time. I think you can run more than one at once. The other cool thing is you can jump around from them and I actually think you can have targets contain other targets. They also will be able to be named anything which is handy for keeping things organized. Systemctl set-target customWebServerRunningTarget is way more descriptive than init 3. That's just my opinion.

    Everyone would be well served to learn systemd really well as it is actually better (again, my opinion). From a design standpoint it kind of does too much but you can reaaaally automate a machine using it.
  • 0
    I use init 6 to reboot and init 0 to shutdown.
  • 3
    I guess the problem is that "Sudo" is NOT "sudo". In windows nobody cares about that.
  • 1
    @LinusCDE

    Most likely Sudo is OP's keyboard app automatically capitalizing the first character of the first word on what it sees as a sentence.
  • 0
    @bahua But the rant was more a joke than a serious experience. So maybe it was about case-sensitivity.
  • 0
    @LMtx using linux for the first time doesn't sound like having a big server with only ssh access.
    And who shuts down a server?
  • 0
    @ddephor I shutdown server (VM) when I need to migrate it to different location/region. But you are right - that's not what you usually do when you are new to linux.
  • 0
    Don't run node or npm as root.
    Try http://nvm.sh for a good versioned local node installation without root :)
  • 0
    @ddephor or maintenance. Or if you have an environment which is elastic. You can have some monitoring or app performance suites watch how much of a load your server pool is under and automatically spin up or start instances or delete them or shut them down on the other side of things if your load drops.
Add Comment