• @BDHarrington7 said:

    Can you run anything on nodejs as a non-root user? it might be how you installed node...

    You'll have to give me a little more detail on how to test this or fix it, since I'm not 100% sure what you mean. I followed the Wiki's guide for Ubuntu Server I believe.

    And can someone give me 3 reputation points please? I have a 10 minute limit between posts, and with my lack of knowledge, I won't be able to help people enough to actually earn them anytime soon haha.

  • Community Rep

    have you experienced something like this: http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo

    I wish I could remember the steps that caused the same issue where I couldn't run things on node unless I was root, I'm sure somewhere along the way I tried to fix it by changing permissions (which isn't something you should have to do unless you really know what you're doing). In the end I re-installed node and npm making sure I did not use sudo


  • @Ali said:

    @julian @psychobunny help.

    I was able to start it as non root by:

    1. creating an iptables route from 80 to 3000

    2. changing my nodebb config to start from 3000

    3. reapplying permissions (some files had become root because it had been started as root)

    4. is done by:
      sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
      apt-get install iptables-persistent

    It'll ask you to save your current rules, say yes.

    1. edit your config.json
    2. chown, chmod

  • @BDHarrington7 said:

    have you experienced something like this: http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo

    I wish I could remember the steps that caused the same issue where I couldn't run things on node unless I was root, I'm sure somewhere along the way I tried to fix it by changing permissions (which isn't something you should have to do unless you really know what you're doing). In the end I re-installed node and npm making sure I did not use sudo

    No I don't think so. I think the problem was that node wasn't being allowed to bind to port 80. I solved it by binding to 3000 and redirecting via iptables. I can now start it without root

  • Gamers

    It didn't fix @adriangb can't even ls -l in forum now.


  • You mean like use the ls command from the command prompt? What do you mean by "in forum"?

  • Gamers

    Yes ls command, in Forum directory.


  • Maybe you made the director y belong to root or something?

  • Gamers

    I don't know? Can you post detailed chown and chmod codes here please?

  • Community Rep

    @Ali it would probably just be easier to blow away your NodeBB folder and re-clone, than trying to get the permissions right. You're just working on a development environment, right?

  • GNU/Linux Admin

    As others have mentioned, you'll need to reset the owner of all files in the NodeBB folder.

    Keep in mind if any files are owned by root, you need to be the root user to change ownership!

    So that said:

    $ su   # to get to root
    $ cd /path/to/nodebb
    $ ./nodebb stop
    $ chown -R ali:ali .   # change ownership to the "ali" user, for the current directory and all files/directories inside of it
    $ logout   # To get back to the regular unprivileged user
    

    Change ali as necessary.

Suggested Topics

  • 14
  • 9
  • 1
  • 4
  • 1
| |