|Viewing and editing .htaccess file on linux laptop|
file doesn't appear
I have a laptop running gentoo. I need to edit and create .htaccess files for my web sites, but they don't appear in my directories/folders. Letting hidden files show doesn't seem to work either. I figure this has something to do with what .htaccess files actually do on a linux OS. Still there must be a way for me to edit them. And ideas? What do other people using linux as a desktop computer do?
|Letting hidden files show doesn't seem to work either. |
Done that on the editor, or where? What editor is it? How about starting the editor from a command line with the filename as an argument, does that work?
If you can't see it in directory listings, try using a command prompt and typing
Then try opening up your file from the command prompt using something like
Depending on what GUI you are using, there should be an option somewhere to 'show hidden files'
Or you can just create htaccess.txt files and change them on the server after you've uploaded them.
Duckula - Didn't try it from an editor I mean from within Gnome. I usually use gedit for most plain text, would something else be better for an htaccess file?
|How about starting the editor from a command line with the filename as an argument, does that work? |
I have no idea how to do that!
(OT - I used to watch a cartoon called Count Duckula - is your name related to that?)
nobody - I tried ls, but the file didn't show up. What is pico, a plain text editor? I'm using Gnome, but .htaccess files still don't show up when checking the show hidden files box.
sonjay - that would work when I'm creating a new file, but won't help when I need to edit an existing one. I might be able to edit the file on the server through gftp. It usually takes me a while to figure out how to write a new mod_rewrite though, so I don't know if it would be a good idea for me to be connected through ftp that long while I figure it out.
I wonder if I need root access to get to htaccess files?
Trisha, is it on your local system or on the remote system that you can't see or create an .htaccess file?
I've never used (or even heard of) gftp, but most ftp editors will let you edit a file on the remote system. You might need to look in the preferences for an option like "Show hidden files" or "Show dot files" or something along those lines. Also with telnet and ssh you can usually edit such files using pico or whatever editor the server has available.
I can tell you that no, you definitely do not need root access to edit an .htaccess file, unless your server is set up in a very unusual manner. The whole purpose of .htaccess files is to let the user for a given site set or change certain configurations for his site without root access.
BTW, I'm usually connected to remote sites via ftp for hours at a time, and I've never run into problems. Again, unless your server specifically puts limits in place, you can sit there with your ftp connection on all day long.
sonjay - its on my local system, my linux laptop, that I can't see the .htaccess files.
I'll try keeping a local copy of the file as a .txt, working on it that way, then edit the real file on the server once I decide how I want it done.
|I'm usually connected to remote sites via ftp for hours at a time, and I've never run into problems |
I always just figured it wasn't a good idea because I thought ftp isn't really that secure. That's good to know, because I do tend stay connected for quite a while at a time.
Still, I wish there was a way to view them as easily as I could on my old nt machine. So far I've had to go back to that old computer everytime I've needed to work on an htaccess file.
If you can see the .htaccess file on the remote server via ftp, does your ftp program let you, say, duplicate it on the remote, rename it to eliminate the leading dot, and then download it? Or does your ftp program let you edit it directly on the server? Either one of those methods would give you access to it. (I'd prefer downloading over working on a live file, myself.)
The security gurus might be able to chime in here on the issue of ftp security, but I'm not aware of any security risk from just keeping an ftp connection open. As far as I know, FTP is only not very secure because it sends everything in the clear with no encryption. That's the case whether your connection is open for five minutes or five days. (Now, running an ftp server on your computer could definitely present a risk, but that's not what you're doing when you ftp in to a remote server.)
I'm a little confused - you say you're using Gnome? Are you using Nautilus (the Gnome file manager)?
If so, Go to Edit > Preferences and select the option "Show hidden and backup files". The files beginning with a dot like .htaccess are usually shown at the end of the listing after the standard files.
You can use Gedit or your favorite text editor to view and edit the file.
Is that what you're looking for?
Sonjay - I can right click on the file on the server and have an option to edit, but when I try it doesn't let me.
I did find a way to do it though, through gFTP, on my computer I can right click and choose edit too, it opens in gedit and I was able to save it that way.
encyclo - yes, you are right, Nautilus - I'm new to linux and don't have the terminology quite right yet.
"Edit > Preferences etc..."
I had tried that and the file still didn't show up, and still isn't on most of my web sites. But now it is showing up for the one I was working on most recently. Not sure why that is. Maybe when I copied the files originally and moved them to this computer the .htaccess files didn't make it for some reason? I believe I did download a copy from the server to this computer today for the one site that it does now show for. So maybe they weren't there to begin with, but they should have been because I copied all files from my web sites and moved them to this computer a while back.
And its good to know I can use Gedit for it. I didn't know which editor to use for certain that wouldn't cause line ending problems or something of that sort. I knew I could use notepad (as opposed to Word) on windows, but wasn't sure yet on linux.
Thanks, sorry if it ended up sounding like a silly question.
<As far as I know, FTP is only not very secure because it sends everything in the clear with no encryption. That's the case whether your connection is open for five minutes or five days.>
That's right.. the security issue is not in being connected, but in transferring data, as anyone sitting in the middle of that connection can intercept and view (or change) what's happening. Even more importantly, you're sending your username and password in plain text, so establishing an FTP connection is the most vulnerable portion of the process.
You may want to look into SFTP and/or SCP. Both of these run over SSH.
I never thought of it that way, Nick.... So if you're going to use regular ftp (as opposed to sftp), it could actually be considered more secure to open your connection and then keep it open all day, rather than connecting and disconnecting more frequently. Then there's only one opportunity for someone to intercept your login info.
That's true.. it would be only slightly more secure. My personal preference, however, is still to use SSH.. which just about every non-Windows box should have up and running.
|I had tried that and the file still didn't show up, and still isn't on most of my web sites. But now it is showing up for the one I was working on most recently. Not sure why that is. Maybe when I copied the files originally and moved them to this computer the .htaccess files didn't make it for some reason? |
If you couldn't see the .htaccess file when you downloaded the site, you wouldn't have selected it, and thus it wouldn't have been copied. Downloading it again for each site should fix that problem.
Also, perhaps you're more familiar with "nano" than "pico"? They're basically the same thing (nano is the GNU version/fork of pico), but I'm pretty sure you have used nano at least while installing Gentoo. It may be a good idea to open a terminal and use the shell for a while to get used to how things work, especially if you're running Gentoo, which requires more of that low-level knowledge.
Just don't "su -" to root unless you absolutely have to, since it's much easier to screw up your system from the shell...