henrikpersson / rsub

Use rmate with Sublime Text.
458 stars 70 forks source link

Unable to open root files #65

Closed alexandre1985 closed 8 years ago

alexandre1985 commented 8 years ago

I have changed rsub default port and it works great. I'm on a debian machine. But when I try to change root priveligied files with sudo or in root user it doesn't work. It says: /usr/local/bin/rsub: connect: Connection refused /usr/local/bin/rsub: line 327: /dev/tcp/localhost/52698: Connection refused Unable to connect to TextMate on localhost:52698

It appears that on root user rsub tries to use the default port instead of the one that i'm using. Hope that someone can give me some feedback. Thanks

KES777 commented 8 years ago

That is because of shell. When you use sudo you run target program at root environment, not user

try to use -E option to preserve your current environment:

sudo -E rsub ...
alexandre1985 commented 8 years ago

No, it was because I had an alias "rsub -p 2222" on user and not on root. Do you know how I can change the default port that rsub uses so that I can delete the alias? Thank you

KES777 commented 8 years ago

Yes, it is. That is different environment for user and root. Have you tried -E sudo option?

You can also do in your .bashrc or .bash_profile to setup port for rsub:

export RMATE_PORT="12345"
alexandre1985 commented 8 years ago

Thank you for the RMATE_PORT tip. Didn't know that. I already deleted the alias but when I had and tried with sudo -E it didn't work because I had no alias in root. Now it works with the RMATE_PORT :)