PDA

View Full Version : FTP as root


todaynet
2003-09-22, 16:27 PM
I can't figure out how to ftp my server (Red Hat 7.3) as root or equivalent. The server doesn't accept my FTP login as root. If I login as the primary user, Pure-ftpd restricts me to the user directory, so I can't see the rest of the server.

Can anyone tell me how to either change the primary user profile or FTP permissions so I can see the whole server; or how to ftp as root?

-kevin-

Tino Didriksen
2003-09-22, 16:44 PM
You don't want to do that. FTP is very insecure. Your root password would be sent over an unencrypted link, for anyone to sniff out...

If you need to access the server's file tree in a more human way, install Webmin and set it up to run in SSL mode. It has a quite good File Manager (Java) with a tree view, editor, move, copy, paste, chmod/chown, etc...

QT
2003-09-22, 17:52 PM
Originally posted by todaynet
I can't figure out how to ftp my server (Red Hat 7.3) as root or equivalent. The server doesn't accept my FTP login as root. If I login as the primary user, Pure-ftpd restricts me to the user directory, so I can't see the rest of the server.

Can anyone tell me how to either change the primary user profile or FTP permissions so I can see the whole server; or how to ftp as root?

-kevin-

If you want to modify system files outside of your home directory, you should be using SSH. You really don't want FTP users wandering around your filesystem. Even if they can't change things, they can find information that may allow a compromise. :)

todaynet
2003-09-22, 19:00 PM
OK, thanks for the helpful comments.

I am already using SSH to administer the server in various ways. My habit in the past on other servers has been to use telnet for file system, user admin and similar tasks; but to edit config files, scripts and the like locally (using a good text editor), and ftp back and forth.

So I guess I just need to understand how to move files back and forth through the SSH connection. Can you point me in the right direction?

-kevin-

QT
2003-09-22, 19:36 PM
Originally posted by todaynet
OK, thanks for the helpful comments.

I am already using SSH to administer the server in various ways. My habit in the past on other servers has been to use telnet for file system, user admin and similar tasks; but to edit config files, scripts and the like locally (using a good text editor), and ftp back and forth.

So I guess I just need to understand how to move files back and forth through the SSH connection. Can you point me in the right direction?

-kevin-

The mv or the cp command will get your files moved back and forth.

brent
2003-09-22, 21:02 PM
With wu_ftpd you can play around the whole server - just set your user account to not be a guest account. I'd take the advice of the others here though... you really don't want to do this. :)

todaynet
2003-09-22, 21:17 PM
Thanks all - I think I've got it now! :)

Thom
2003-09-25, 03:26 AM
figured it out.

elderban
2003-09-26, 14:39 PM
There is also a simple text editor available on every RH system called "vi". Just type:

vi <filename>

And you can edit via SSH. Be sure you are logged on as root, though, if it's a system file...otherwise it opens it as Read-Only.

A few simple commands to remember for vi are:

:w to write to the file
:q to quit
/ <search text> will search the file for the selected text.

and commands can be joined, such as:

:wq to write then quit

When you first open the file, it won't let you make any changes til you hit the "Insert" key. Then to get out of editing mode, just hit the escape key.

It's a little confusing at first, but you'll get used to it.

There is another option out there called Pico, but that seems to have disappeared with RH 8 or greater installs.

Oh, and I would consider using vsftpd for a FTP dameon. Wu-FTP has problems (IMHO). And, vsftpd is much faster.

As for an FTP client, you may want to check out ncftp. The current FTP clien is outdated, and ncftp has many more options, like copying directories recursively and stuff like that.

Darkon
2003-10-02, 10:14 AM
i downloaded Putty to go to the server thru SSH.
it asks for login, so i fill in 'root'
as password i use the password given in the email...

Access denied.

Ehm.... did i miss anything? Do i need to do something else before i can logon with that password?

QT
2003-10-02, 10:23 AM
Originally posted by Darkon
i downloaded Putty to go to the server thru SSH.
it asks for login, so i fill in 'root'
as password i use the password given in the email...

Access denied.

Ehm.... did i miss anything? Do i need to do something else before i can logon with that password?

You need to log in as a normal user and the type:

su - <enter>

root password <enter>

:)

Darkon
2003-10-02, 10:42 AM
thanks QT! :)

other question tho: when I use 'dirs' I expect a list of directories/files in the root. Instead I only see '~'.
Again: did I miss something? Or is everything hidden by default..?

Beowulf
2003-10-02, 10:55 AM
try ls or dir :)

knightfoo
2003-10-02, 10:56 AM
Originally posted by Darkon
thanks QT! :)

other question tho: when I use 'dirs' I expect a list of directories/files in the root. Instead I only see '~'.
Again: did I miss something? Or is everything hidden by default..?

After you switch to root, you are in the directory "/root", and it is normal for that directory to be empty (unless you put something in it). Most configuration files are in /etc, and your vhosts are located in /home/httpd/vhosts .. you will have to cd to these directories to see what files are there, or just use ls:

# ls /etc
# ls /home/httpd/vhosts

Once you find the file you want to edit:

# vim /home/httpd/vhosts/somedomain.com/conf/httpd.include
(just an example)

On that note, you should probably run "vimtutor" at some time so you can become familiar with the vim editing commands.

-knightfoo

Darkon
2003-10-02, 11:51 AM
thanks knightfoo! works great!
Also thanks for the tip about vimtutor... I needed that! (last time I did something with vi editing was more than 10 years ago, so... time to get the dust off!):D