Discussion:
Mac newbie question: editing files in folders owned by root
David Nicholls
2008-05-06 07:12:38 UTC
Permalink
I want to edit some application template files that are embedded down
two "package" levels - the packages and the files in question are owned
by root. And I want to be able to write safe copies of the originals to
the same folder.

Is there a simple way to do this in BBEdit? ie a "sudo" equivalent?

I'm still learning how this stuff works.

DN
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Johan Solve
2008-05-06 07:26:22 UTC
Permalink
I want to edit some application template files that are embedded down two "package" levels - the packages and the files in question are owned by root. And I want to be able to write safe copies of the originals to the same folder.
Is there a simple way to do this in BBEdit? ie a "sudo" equivalent?
Yes, BBEdit prompts you to authenticate when you try to save a file that you don't have write permissions for (after warning you when you start editing it). Much like a sudo but afterwards.

"Make backup before saving" with the "Use document's folder" option under Text files in Preferences seems to be right for for the copy but I'm not sure how BBEdit handles a situation where you don't have write permissions to the folder. Just try it.
--
Johan Sölve [FSA Member, Lasso Partner]
Web Application/Lasso/FileMaker Developer
MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se mailto:joh-***@montania.se
(spam-safe email address, replace '-' with 'a')
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
David Nicholls
2008-05-06 07:35:57 UTC
Permalink
Post by Johan Solve
Post by David Nicholls
I want to edit some application template files that are embedded
down two "package" levels - the packages and the files in question
are owned by root. And I want to be able to write safe copies of
the originals to the same folder.
Is there a simple way to do this in BBEdit? ie a "sudo"
equivalent?
Yes, BBEdit prompts you to authenticate when you try to save a file
that you don't have write permissions for (after warning you when you
start editing it). Much like a sudo but afterwards.
"Make backup before saving" with the "Use document's folder" option
under Text files in Preferences seems to be right for for the copy
but I'm not sure how BBEdit handles a situation where you don't have
write permissions to the folder. Just try it.
I had done that and got a "-5000 error code". Both for saving the safe
copy and trying to save the existing file. No warning until failure.

Maybe I'll need to go in using Terminal?

DN
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Charlie Garrison
2008-05-06 07:38:46 UTC
Permalink
Good afternoon,
Post by David Nicholls
I want to edit some application template files that are
embedded down two "package" levels - the packages and the files
in question are owned by root. And I want to be able to write
safe copies of the originals to the same folder.
Is there a simple way to do this in BBEdit? ie a "sudo" equivalent?
I'm still learning how this stuff works.
Is the pencil icon marked with a red cross? Click it and you
should be able to unlock the file for writing.


Charlie
--
Charlie Garrison <***@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
David Nicholls
2008-05-06 08:09:37 UTC
Permalink
Post by Charlie Garrison
Good afternoon,
Post by David Nicholls
I want to edit some application template files that are embedded down
two "package" levels - the packages and the files in question are
owned by root. And I want to be able to write safe copies of the
originals to the same folder.
Is there a simple way to do this in BBEdit? ie a "sudo" equivalent?
I'm still learning how this stuff works.
Is the pencil icon marked with a red cross? Click it and you should be
able to unlock the file for writing.
Yep, I did that, said yes to open for editing and tried to save as a
safe copy, 5000 error again. I think it must be a folder permissions
problem.

DN
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Charlie Garrison
2008-05-06 09:18:35 UTC
Permalink
Good evening,
Post by David Nicholls
Yep, I did that, said yes to open for editing and tried to save
as a safe copy, 5000 error again. I think it must be a folder
permissions problem.
Sorry, missed that you wanted to save a copy. I always use the
shell to make a copy and then go from there.

As far as I know, BBEdit doesn't have a way to create new files
(save as) in a protected directory. You should be able to make a
copy using 'cp' from a BBEdit worksheet, but I haven't tried it.
Click the lock first to allow sudo (type) access in the worksheet.


Charlie
--
Charlie Garrison <***@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
David Nicholls
2008-05-06 09:56:35 UTC
Permalink
Post by Charlie Garrison
Good evening,
Post by David Nicholls
Yep, I did that, said yes to open for editing and tried to save as a
safe copy, 5000 error again. I think it must be a folder permissions
problem.
Sorry, missed that you wanted to save a copy. I always use the shell to
make a copy and then go from there.
As far as I know, BBEdit doesn't have a way to create new files (save
as) in a protected directory. You should be able to make a copy using
'cp' from a BBEdit worksheet, but I haven't tried it. Click the lock
first to allow sudo (type) access in the worksheet.
Thanks. Now I've struck another block: how to I get inside an
application's contents?

The full path to the file I want is /Applications/Adobe Lightroom.app
/Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
/default_html.lrwebengine/detail.html

where Adobe Ligthroom.app, Web.agmodule and default_html.lrwebengine are
all applications whose contents I can explore using Finder. But trying
to use cd in Terminal to get inside Adobe Lightroom.app (etc) tells me
there's no such directory.

Is this possible? If not, perhaps I can save the original file to
somewhere normal and use it as a reference if I need to revert the
edited file.

I don't want to edit anything until I know I can get back to the
starting point.

DN
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
David Nicholls
2008-05-06 10:28:16 UTC
Permalink
Post by David Nicholls
Thanks. Now I've struck another block: how to I get inside an
application's contents?
The full path to the file I want is /Applications/Adobe Lightroom.app
/Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
/default_html.lrwebengine/detail.html
where Adobe Ligthroom.app, Web.agmodule and default_html.lrwebengine are
all applications whose contents I can explore using Finder. But trying
to use cd in Terminal to get inside Adobe Lightroom.app (etc) tells me
there's no such directory.
Is this possible? If not, perhaps I can save the original file to
somewhere normal and use it as a reference if I need to revert the
edited file.
I found a script called Open Terminal Here which is added to the Finder
toolbar and opens terminal where you've navigated to.
http://www.entropy.ch/software/applescript/

Problem solved. I think.

DN
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Charlie Garrison
2008-05-06 11:58:34 UTC
Permalink
Good evening,
Post by David Nicholls
The full path to the file I want is /Applications/Adobe Lightroom.app
/Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
/default_html.lrwebengine/detail.html
where Adobe Ligthroom.app, Web.agmodule and
default_html.lrwebengine are all applications whose contents I
can explore using Finder. But trying to use cd in Terminal to
get inside Adobe Lightroom.app (etc) tells me there's no such directory.
How are you entering the command? I'm guessing you aren't
escaping the space or quoting the full path. I find tab
completion to be a great way to have special characters escaped
for me by bash.


Charlie
--
Charlie Garrison <***@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
David Nicholls
2008-05-06 12:53:02 UTC
Permalink
Post by David Nicholls
The full path to the file I want is /Applications/Adobe Lightroom.app
/Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
/default_html.lrwebengine/detail.html
where Adobe Ligthroom.app, Web.agmodule and default_html.lrwebengine
are all applications whose contents I can explore using Finder. But
trying to use cd in Terminal to get inside Adobe Lightroom.app (etc)
tells me there's no such directory.
How are you entering the command? I'm guessing you aren't escaping the
space or quoting the full path. I find tab completion to be a great way
to have special characters escaped for me by bash.
You're undoubtedly correct. I'm only just weaned off MS DOS commends
(yeccchh!) so my Unix is a bit vestigial still!

DN
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Doug McNutt
2008-05-06 14:38:38 UTC
Permalink
I want to edit some application template files that are embedded down two "package" levels - the packages and the files in question are owned by root. And I want to be able to write safe copies of the originals to the same folder.
Is there a simple way to do this in BBEdit? ie a "sudo" equivalent?
I had the same kind of problem yesterday with gedit. The solution was to create the backup file with Terminal and then go into the editor with a command line.

cd /etc
sudo touch hosts~
sudo gedit hosts

I suspect that the bbedit tool would do something similar

cd your_package_directory
sudo touch the bbedit backup_file_you_expect
sudo bbedit yourpackagedirectory/the_file_to_be_edited

In any case getting into files and directories that Finder really doesn't want to show is pretty much always easier with the bbedit tool than with the Open or Save-As menu items.

You can also use the chmod tool with sudo to open up permissions on the files and directories that bother you. it won't affect the way they work unless some program - ssh - demands that they be closed off for security reasons.

man chmod # for more
--
--> The best programming tool is a soldering iron <--
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Charlie Garrison
2008-05-07 00:10:03 UTC
Permalink
Good morning,

On 6/5/08 at 8:38 AM -0600, Doug McNutt
Post by Doug McNutt
I suspect that the bbedit tool would do something similar
cd your_package_directory
sudo touch the bbedit backup_file_you_expect
sudo bbedit yourpackagedirectory/the_file_to_be_edited
Using 'sudo bbedit' will not gain you anything over just
'bbedit'. The command line tool is not an editor; it's just a
nice/simple way to get BBEdit to open (or create) documents.
BBEdit will still need to have access to the file before it can
read/save. So all the same rules discussed previously still apply.


Charlie
--
Charlie Garrison <***@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Loading...