Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a couple of servers I work on, despite having access to edit files and all else, there is the occasional need to gain elevated privileges (like running sudo) with the file to actually save the changes.

That said I like working with my files in Coda 2 and not the Terminal directly. So is there either a way to sudo the file open through the explorer when viewing the remote files, or is there a way to trigger a file to open through the built-in terminal in Coda 2 so I can make the edits, save, and move on.

Currently when I double click on a file to open it, if I would need elevated privileges, the file will open only in a read-only state.

share|improve this question
up vote 3 down vote accepted

No, it can not. Coda 2, Coda, and Transmit all allow you to SFTP into a box, but when you try to access a file that is not in your user's accessible range, you have to log out and then log back in as a user who can.

I use Transmit and Coda 2 constantly and just have made it to where I am only signing in as root because I ended up having to log in as different users to access one file and then a different file.

I wish there was another way around it, like being able to have Transmit, Coda, or Coda 2 push some kind of command to the server or something but it isn't possible in any of the Apps current states. I would highly recommend doing a feature request to them, I can't see how we would have been the only people who have ever wanted this.

I would recommend trying to contact them through their twitter account. They are pretty cool guys and have responded to things like this before on Twitter.

http://twitter.com/#!/panic

I know it wasn't the answer you were probably looking for but I hope it helps.

share|improve this answer
1  
I couldn't agree more. It'd be lovely if lets say like "Windows" when you right click on a file you can "Run it as Administer" if Coda 2 could add that, it would make life easier, kinda like "Open with sudo". My thing is my user has sudo rights, but in many cases I have to explicitly do "sudo ....." then rekey my password, if an option on Coda could be done like that even if it prompt for password in the process things would be awesome. – chris Jun 18 '12 at 23:35
    
@Chris That would be a nice feature, I highly recommend shooting them that feature request. It is probably something that they want to implement anyway and the more who ask only helps spure them on. – de_an777 Jun 19 '12 at 2:15
    
point taken, and will be done – chris Jun 19 '12 at 2:24

An "open as sudo" command has still not been implemented in Coda2 so I have been using the following workaround to be able to edit a file that belongs to another user or root without having to use something as painful as vi

  1. Open a terminal connection in a tab in the SFTP connection.
  2. Run a chown command on the file to the user you can login as (this user must have sudo privs). Be sure to note who original user was.

    sudo chown your-user-name path/to/file

  3. Navigate to the file and click to open it, edit what you need and click save and close the file.

  4. Go back to the terminal window and chown it back to the original user:

    sudo chown original-user-name path/to/file

Obviously this is not the ideal situation, but it does make it so you can use all the awesomeness of Coda to edit the file instead of vi or other editors built into the command line.

share|improve this answer
1  
This is also what I do unfortunately, more often than not I tend to work on large file sets so I sometimes do it to the whole directory I am working in. But its just overhead I don't like. More often than not its read only for a reason and I fear one day I will forget to set it back, and whoops would be my luck.. – chris Dec 28 '15 at 15:38
    
Yep. We should keep asking Panic to add this 'edit using sudo' function. It is a needed thing. It would also be nice to have a right click command to unzip a file. I use the terminal to do that a lot. Maybe someone out there will write a plugin for this stuff too. I don't know if it is possible, but there are some awesome plugins I use. I have not looked at how the plugins are made but I should look into if it is an easy function we could add on our own. – pathfinder Dec 28 '15 at 20:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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