Closed Miladiir closed 10 years ago
I think you meant to type
sudo xeno edit some-file.txt
edit
is something different on Linux and other systems which tries to open files using mailcap (see man edit
). Anyway, try using xeno edit
.
Also, you should not run xeno as root using sudo because it won't work for a variety of reasons (in particular, the synchronization won't work unless you normally log into the remote machine as root, which you should not do).
I've closed this for now, but reopen if that doesn't help.
Oh sorry, I forgot to mention that I aliased edit to xeno edit.
Well, judging by the error that it spit out, I would assume the original edit
command is still coming through, because xeno knows nothing of mailcap and the original command would produce precisely the error you're seeing. What's probably happening is that when you type sudo, your alias is not respected (which is the default behavior) so it's going to the original edit command. Anyway, as I mentioned, there should be no need to run as root, and in fact you shouldn't, so try just using the edit alias you've created.
Well, now I feel stupid. But how would I use xeno and my text editor to edit files that require higher permission? For example, if I wanted to edit the configuration files of nginx, what would I need to configure additionally to make it work?
Ah, I see your question. To be honest, I hadn't considered the use case of elevated privileges. The main issue is that xeno uses Git's SSH protocol as its synchronization mechanism, which requires being able to connect directly to the machine as root, not just initializing the sync as root. If you can log into the machine as root (which it sounds like you can't) then it would work. Given that you can't do that, the only thing I could think of doing would be adding yourself to a group that has permission on the file you want to access (probably root
or wheel
in your case) then you can just run xeno as your normal user and it should work.
Other than that, I'm afraid it's somewhat of a limitation of Git to be able to do cross-user (especially as root) synchronization. Perhaps one could do some SSH key magic, but I think that would lead to a really insecure setup...
Just note that if you do add yourself to a group like that, you'll have to log-out and log-in before the effect will take place.
Thanks, I will look into doing something like that.
Here is what I did and what I got:
I tried messing around with my setup, however I couldn't get it working. As I have no root permissions but am able to sudo, it would be nice if xeno would allow this.