4

I do not have very much linux experience. Previously I administered a debian machine on a local network by logging in as root, and using ftp as root. Now I m working with an Ubuntu machine, and having to type sudo for everything is annoying but manageable. However, I am unable to manage files because I don't know how to set up an ftp client with the ability to manipulate files outside the /home directory. How should I be going about this?

More details: The system is a local development system for web development. The most common reasons I need file access are to modify apache and mysql config files. I connect to it from my windows XP system using putty for terminal and filezilla for ftp. Ideally I'd like to be able to use ftp to download a config file, edit it in a gui I understand, and then put it back on the server.

Matt
  • 157
  • 1
  • 1
  • 5

6 Answers6

3

You can use winscp which is a free SFTP, FTP and SCP client for Windows. You can copy the files from the Linux system. Then, you can edit the files on Windows in the way you want. Finally, you can copy them back (overwrite) to the Linux system.

If you need to restart some service, you can use ssh.

Khaled
  • 36,533
  • 8
  • 72
  • 99
  • I installed winscp but its the same as with filezilla, my admin account isnt permited to manipulate files outside the home directory – Matt Dec 06 '10 at 15:15
  • @Matt: So, you may need to use a different account! – Khaled Dec 06 '10 at 16:17
  • you would need to enable the root account and enable root logins for ssh. I it's a development system it would probably be ok, for better security I would suggest installing something like denyhosts and changing the ssh port to something other than 22 – Jure1873 Dec 06 '10 at 19:46
2

First things first, you need to sort out your SSH, from which you can do any/all of the things suggested here as far as running x (think of this as "remote desktop"), managing files, etc.

I'd recommend setting up passwordless SSH using keys. They're more secure (wait till you start looking at all the brute force attempts in your auth logs from bots trying to guess your ssh password; mine was reduced to nil when I disabled password authentication and only permitted key authentication). There's a lot of tutorials on the subject, probably the easiest method if your workstation is Windows is using PuTTYGen from the makers of PuTTY to create a public key and a private key that'll be compatible with WinSCP, PuTTY, etc.

If you want to use something like WinSCP, you can then change the sudoer config on your server to allow the sudo command to be executed for only /bin/sftp-server without requiring a password. After that's done, you can modify WinSCP to execute sudo /bin/sftp-server to elevate the privileges of the sftp-server process that WinSCP uses to manage files with SSH File Transfer Protocol (SFTP, not to be confused with FTPS). This procedure is covered here.

I have mixed feelings about this; I think it's better to grant privileges for your user to the files and folders that said user needs to edit. i.e. if you're just managing some /var/www files, you can either change the site root to /home/user/www and grant the appropriate Apache user (www-data for Ubuntu) the right permissions to read and execute files in that directory or do vice-versa, and grant your user read and write privileges to /var/www. If you go the latter route, I find it easier to create a group called "webdev" and add your user (and any other users that may need to edit the website) to that directory.

That way you can automate the promotion process with scripts using tools like scp and rsync to reduce errors that can come with doing manual uploads and/or file changes.

gravyface
  • 13,957
  • 19
  • 68
  • 100
1

FTP maybe is not a necessity. Have you considered using dolphin (or any other file manager on ubuntu) and exporting it's display trough the ssh tunnel ? It will spare you the FTP administration, ports, user credentials, etc...

You need a local X server for this, provided by default on linux, but on windows you should install xming which is free.

ssh -Y remotemachine -l root (or any other sudoer)

my_prefered_filemanager

"dolphin" is like the file explorer for linux, it's a gui for moving files.

"ssh tunnel" means that the program that you start on the server will be displayed on your machine: ie it will popup a graphical interface on your screen, not on the server screen.

"local X server" is the server that receive the informations from the program you have started. Xming is a example of an X server for windows. You install it on your windows client and it waits for a connection incoming from your server.

1) download and install Xming for windows. Also download and install fonts for Xming. Both are free, google for it. Don't forget to run it afterwards, it will appear with the icons near the windows clock. No window will be visible yet at this step.

2) open putty but before starting your connection, enable the X forwarding, it's in the ssh options of putty, in the left tree, near the bottom. Save the config and start the connection like you did usualy. This setting is totally transparent, if you don't use grapical interface in a putty session it won't make any difference if the tunnel is enabled or not.

3) try your tunnel: from your shell start any program that have a GUI interface, it should popup on your windows desktop. for example start nedit, of gedit. If it popup then you're ready. Now you need to start this program as root. try to "sudo nedit" (then browse to the file you want to edit from the nedit file menu). If it doesn't work you may have to "sudo -s" first, then to start "nedit". nedit and gedit are typical, very light, editor programs. Maybe you have another one installed in ubuntu that you prefer,you can use any program you want, it's not important.

Rosco
  • 455
  • 3
  • 6
  • Things I don't know anything about from your answer: 'dolphin', 'ssh tunnel', 'local X server', 'xming' . Which should I start with? – Matt Dec 06 '10 at 15:09
  • "dolphin" is like the file explorer for linux, it's a gui for moving files. "ssh tunnel" means that the program that you start on the server will affect your machine: ie it will popup a graphical interface on your screen, not on the server screen. "local X server" is the server that receive the informations from the program you have started. Xming is a example of an X server for windows. – Rosco Dec 09 '10 at 16:30
1

First thing you need to do is work out a model for what the permissions should be (depending on the software using the files, users requiring access etc). I look after several Linux systems - I never use ftp, I block root access via ssh, and rarely use 'su' - OTOH I try to avoid Ubuntu due to the unusual approach it takes to various things, including root access.

Unfortunately without knowing a lot more about the files you modify outside of '/home' it's hard to give specific advice. I'd recommend looking hard at scp / sftp though - but since you've not provided any information about the client OS you are using to connect, its hard to give specific advice (WinSCP for MSWindows? the fish: wrappers in KDE?)

symcbean
  • 21,009
  • 1
  • 31
  • 52
1

Install Webmin. You can then use your web browser to login as root and use Webmin's FileManager module to manage files anywhere in the entire filesystem. Note that FileManager requires Java support in your browser.

Webmin also has modules that provide the ability to administer Apache and MySQL configurations from within its web interface. There is no need to edit text files.

Finally, though not connected to Webmin in any way, phpMyAdmin is one of the best (if not the best) MySQL administration apps available. Like Webmin, it is a web app.

Steven Monday
  • 13,599
  • 4
  • 36
  • 45
0

I second Steven's suggestion. Webmin will be an ideal tool to use in your scenario. You'll soon become curious with the rest of the features and will want to learn them :-)

Bourne
  • 1,039
  • 5
  • 18
  • 24