2

After being told that Virtual Private Servers would not fit the scope of my project, I have timidly entered the world of dedicated hosting. Unfortunately, this is forcing me how to learn the basics of being a Linux server admin.

GoDaddy has a master account for the server. When you use SSH, they want you to use "su" to switch to the root user. Thus far, I have been able to do everything I have needed to thus far via the command line as this root user.

However, now I need to upload files to my server. I'm used to using WinSCP to upload files. I can use my general server account to view the files but when I try to drag or create files its says that I cannot because I do not have permission to do so.

I have researched the WinSCP documentation and it seems that this "su" function is beyond the scope of the program.

How am I to grant myself access to upload these files using SSH?

Should I create a user with the proper permissions? I'm happy to do this but thus far I have not been able to make sense of what I have found online.

I'm going to try and move forward but any help and/or insight is appreciated.

4 Answers 4

0

I am not familiar with GoDaddy but you can upload files with winscp to some dir. limited user has write access - i.e. home directory

then ssh to the server, su root and move files to the proper place and eventually adjust permissions

you can use some console file manager like Midnight Commander (mc) if is installed on the server

3
  • When you say console manager, you mean something like the "control panel" provided by GoDaddy or something different?
    – Scott
    Dec 23, 2010 at 17:37
  • I have not yet actually tried to upload to that users default director. Perhaps I do have write access there. I will look into that. I don't know if uploading and moving would be my first choice but that might be a workable solution to move forward.
    – Scott
    Dec 23, 2010 at 17:37
  • I confirmed that I can upload to the directory that is the default for that user.
    – Scott
    Dec 23, 2010 at 17:58
1

You can run su within WinSCP, but it's not very intuitive to figure out how.

In the connection settings, under Environment/SCP/Shell, look for the top item, called "Shell" in that box, type su -... or any command you wish. Normally, this is used to choose which shell will run - but when you just put a command like su - there, it will instead begin a shell session as root, using root's profile (the - option), so the default shell for root will run.

18
  • This sounds promising. I agree it is not clear how you would go about doing it. I would type "su root" assuming root was the user I wanted to switch to?
    – Scott
    Dec 23, 2010 at 17:41
  • root is the default user that su switches you to, so you don't need to specify it. (though you can, if you like). The dash option might be important in this case, also, since no shell is being defined otherwise. Not 100% sure on that (I always use su - out of habit). Dec 23, 2010 at 17:43
  • OK, I was trying to figure out if that "-" was a space holder or an actual dash.
    – Scott
    Dec 23, 2010 at 17:54
  • Oh, yes, I always forget about that! The dash is a literal argument to su which causes it to load the shell environment for the user you are switching to... things like the PATH and such, for example. Dec 23, 2010 at 17:59
  • Thus far it seems to be ignoring it. I did find the spot where you said to enter the command and I typed "su -" and then connected as normnal. I don't get any error message either.
    – Scott
    Dec 23, 2010 at 19:08
0

One solution would be use scp instead of winscp. This would require a local computer running *nix. Cygwin will let you run *nix locally within windows. Or if you have a spare computer, you could install linux on it. Or dual boot your computer. Or use a Mac.

3
  • Mac's are scary!
    – Scott
    Dec 23, 2010 at 17:42
  • So SCP wouldb e the linux equivalent. and cygwin would be some sort of linux box or imitator on windows? This is some stuff to look into. Thank you.
    – Scott
    Dec 23, 2010 at 17:49
  • WinSCP is the windows version of SCP. Yes, cygwin is program that lets you run linux programs from windows. Dec 23, 2010 at 22:35
0

I think the better question is, why are you trying to update files as root through scp? If this is a matter of deploying files, you should be looking into config management systems and installers.

For example, if you're copying over configs, take a look at puppet or cfengine. If you're looking at installing programs, look into your particular Linux distro's package management system (aptitude, yum, etc.).

I could also tell you that your ultimate solution would be to login as the root user, but that poses a huge security hole, and is disabled on most systems. But if you want to go down this path, you can re-enable root login by opening your SSH config (most likely in /etc/ssh/sshd_config) and setting:

PermitRootLogin yes

And then restart sshd:

sudo /etc/init.d/sshd restart

Andrew

12
  • I'm trying to upload drupal modules. They are folders that contain PHP. They need to be pulled down off the drupal website. What method do you think is best for that?
    – Scott
    Dec 24, 2010 at 2:53
  • In that case, you probably want to upload them as yourself, and then extract/move the modules using sudo or su.
    – Andrew M.
    Dec 24, 2010 at 3:01
  • the other option is when you ssh to the server: wget http://drupal...../path/to/the/file
    – jet
    Dec 24, 2010 at 16:56
  • I thought about doing that. That is kind of where I was ending up. The process is then download, unzip, delete zip, and go. Right?
    – Scott
    Dec 26, 2010 at 17:06
  • I don't really want to "give him root permission" I just want the user to have FTP or secure upload through WinSCP. That is the general idea....
    – Scott
    Dec 27, 2010 at 3:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .