1

I've recently fallen in love with github's Atom text editor, and I enjoy using it for all my local coding and configuration.

I started to maintain a Nagios installation for several dozen servers and I'm realizing that I'm growing tired of using ssh and remote vim to perform my editing. I'd like to use Atom to do this instead.

I've looked into ways of doing this. One of my biggest problems is that Nagios and NRPE configuration files require su permissions to overwrite. I'm editing files in /etc/ and /usr/. I can open the file in Atom locally in many ways, but I can never save it.

Here's a few ways I can think of to deal with this (tell me which you think is the best way or if you've got another idea, I'd love to hear it!).

  1. I could use sftp and try to edit the files here (but I imagine I'd run into root permissions issues when I try to save?)
  2. I could use sshfs to mount the server on my local machine and edit that way (still not sure about permissions issues?)
  3. I could add the user on the remote machine to the sudoers file for full permission without password prompting (but I don't think this is a safe idea, and again, I imagine I'd still need some form of sudo to actually save?)
  4. Just copy the file over and manually use an rsync command to sync the file back over when I'm done editing (which would be rather tedious but is looking to be the most promising).

Is there maybe an Atom plugin you're aware about that might help me?

I know I can't be the first person to want to do this. I did some searching and found some people suggest SSHFS, but I'd like to know what the current thinking is.

Thanks!

migrated from serverfault.com Mar 9 '15 at 18:51

This question came from our site for system and network administrators.

  • 1
    Another problem that can be solved with proper configuration management. – jordanm Mar 9 '15 at 19:07
  • That's pretty much transparent in Emacs, you just have to use a slightly odd syntax when opening the file (/nagioshost|sudo:nagioshost:/etc/foo). No idea about Atom. – Gilles Mar 9 '15 at 23:06
3

What we do in my team is use puppet to control this sort of file with the config stored in a subversion repository. Each person checks out a copy of the repository to their local machine, uses their favoured editor to make changes and then commits the change. The changes are automatically applied to the live machines by puppet (which runs with admin privs).

You don't have to use this exact set of tools but this model separates out the editing (which can be done on any platform) from the application of changes on the server. I think this is what jordanm was hinting at in his comment.

This sort of setup also gives you version control for your config files which is a good thing.

It's possible that this feels like overkill for your situation right now but if your setup is going to scale you should start thinking about this now.

  • I'll have to start thinking about that. Right now it's just a visual/aesthetic choice, but down the line it's definitely going to be a problem. Do you have any recommendations on where one would start with learning puppet? – Harsha K Mar 9 '15 at 21:46
  • @HarshaK using vagrant is a great way to learn any config management system. – jordanm Mar 10 '15 at 2:31
0

I use notepad++ which has a plugin NppFTP. It can be set up to copy files using sftp, then when you save the file, it uses ftp again to store the file on a remote server.

  • 3
    Yes, but two things; Notepad++ is Windows software, and my problem isn't going to be solved by sftp. My problem is that I can't directly save the file due to the fact the remote machine requires su to overwrite this specific file. It's located on /etc and /usr. If I try to save with a client app like that or through sftp, I'll get a permission denied error. – Harsha K Mar 9 '15 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.