Web Hosting Talk







View Full Version : Please Help Start me off on using SSH


dayo
06-30-2007, 11:53 AM
Trying to figure this out and totally clueless how it works. I have a new first time VPS with two domains configured and tried two things on SSH so far

Logging in as root via Terminal on my Mac and was able to get in but then stumped as to where to go next. I know a few commands and ran "ls" and it turns up nothing as in what ever directory I am in has no files in it at all. I then ran"ls-a" to get more info and see I have four .xyz files only.
Thinking I was missing something, I installed MacFusion and went in as root again and this time it was clear since it mounts on Finder that the place was empty. MacFusion mounts an imagedisk on the local finder and the image disk appears to be empty


Can any one please give me the low down on SSH 101?

Thanks

ThatScriptGuy
06-30-2007, 12:11 PM
pwd - It lists your current directory. If you're logging in as root, then you will be placed in /root and it will be empty until you put something in there

cd /the/dir/you/want - Change directory

vi file - Open file in the the VI editor. This is a whole new can of worms and you'll need to look up vi tutorials

That should get you started I guess (might be best to look up ssh tutorials on google for a full listing of commands)

Kevin

PickledOnion
06-30-2007, 12:29 PM
It's not really ssh that you have a concern with but with bash. I'm not being pedantic but that will help in any search for help you have.

Once you are logged in to your VPS, the most common shell script is called bash (The Bourne again Shell).

It'll be difficult to do much in a post to help you but bash is a very powerful but easy to learn language that you use to interact with your server/VPS.

So instead of clicking on a directory to open in as you would in a gui file manager you literally tell it to go into that directory - in this case you would enter cd /directory which says "Change directory to the one I named".

You probably have nothing installed in your home directory which is why there is nothing to see! The files/folders beginning with a period (.) are called 'hidden' files - they do not show up in a normal gui file manager and usually contain local configuration files.

I would imagine a couple of them are called .bashrc and .bash_profile which are the configuration files for bash.

Very quick introduction! I also have some VPS basics and Bash basics tutorials via the link in my signature which may help as an introduction for you.

HTH

dayo
06-30-2007, 12:31 PM
Thanks for that mate

I managed to figure out how to move about and can now navigate to the directory that contains each domain. So if I want to install a binary that will be accessed by each domain, where would that go? I found where Awstats is installed and assume that is a good candidate. Is this correct?

dayo
06-30-2007, 12:33 PM
@Pickled

I will have a look at the tuts. Thanks

dayo
06-30-2007, 12:53 PM
Hi.
It's not really ssh that you have a concern with but with bash. I'm not being pedantic but that will help in any search for help you have.

Once you are logged in to your VPS, the most common shell script is called bash (The Bourne again Shell).
It is Bash indeed. but when I log in, isn't the protocol (?) ssh? since I go ssh etc etc etc?



It'll be difficult to do much in a post to help you but bash is a very powerful but easy to learn language that you use to interact with your server/VPS.

So instead of clicking on a directory to open in as you would in a gui file manager you literally tell it to go into that directory - in this case you would enter cd /directory which says "Change directory to the one I named".

I am familiar with the basic commands mkdir, cd, ls etc.


You probably have nothing installed in your home directory which is why there is nothing to see! The files/folders beginning with a period (.) are called 'hidden' files - they do not show up in a normal gui file manager and usually contain local configuration files.

I would imagine a couple of them are called .bashrc and .bash_profile which are the configuration files for bash. Also understand the hidden files thing from my Mac.

A couple or so of the files are indeed bash files.

Reason why I am actually getting into assessing by the terminal is to figure out where to install some binaries that each domain can access such as jhead, jpegtran and possibly ImageMagick. However, I don't think it is possible to specify a path of /root/xyz for the domains.

If I am getting this right. There is /root which is currently empty (how is this space normally used?) and there is /var/www/rest_of_path_to_domain/public_space. So far the only bin directory I can find outside the domains is /var/cgi-bin. Is this the best place to install binaries? I noticed Awstats is located there.


Very quick introduction! I also have some VPS basics and Bash basics tutorials via the link in my signature which may help as an introduction for you.

HTH
Had a first look at the tuts and will look closer. Thanks

dayo
06-30-2007, 12:55 PM
PS. What's the diff btw Pico and Nano? Used pico before and assume they do the same thing.

gophp
06-30-2007, 02:54 PM
What are you going to do with those binaries? It looks like they are going to be called from your scripts, right? What are you going to run as the Web site? (forum etc)

For those binaries a possible place would be /usr/bin. But most of time you run the installation package and it knows where do they belong.

Why do you need VPS actually? It looks like it will be difficult for you to manage it.

dayo
06-30-2007, 03:19 PM
Thanks

What are you going to do with those binaries? It looks like they are going to be called from your scripts, right? What are you going to run as the Web site? (forum etc)

They are going to be called by scripts. I want to make them available serverwide from one location if possible.


For those binaries, and they do not look like they are going to be called from the Web server, a possible place would be /usr/bin. But most of time you run the installation package and it knows where do they belong.

Will be compiling from source. I ran a server on a mac for a bit (for one site) and can find my way around there. Not being able to find /usr on my CentOS VPS is actually one major thing confusing me. Pickles pointing to Bash makes me more comfortable since I can use this reasonably well.


Why do you need VPS actually? It looks like it will be difficult for you to manage it.
Possibly but most start off somewhere as we are not all born Junior Wannabe Gurus you know? ;)


Thanks though for the post.

dayo
06-30-2007, 03:23 PM
Not being able to find /usr on my CentOS VPS is actually one major thing confusing me.

Got that now right after making the post lol.

Think I am sorted. Thanks for the help everyone.

gophp
06-30-2007, 04:09 PM
On my VPS, ImageMagick can be installed with a click of a mouse Doesn't your hosting provide some standard applications?

To get the list of possible executable locations, if those are non-standard, just do:

echo $PATH

/var/cgi-bin is for scripts called directly by Web server, like awstats. What you need is applications called from scripts and those normally reside there where standard UNIX apps live:

Web server -> script (e.g. Perl script in /var/cgi-bin) -> binary (like "ls" in /usr/bin).

dayo
06-30-2007, 04:19 PM
Thanks.

Was a bit disorientated for a while but now got my bearings.

arkin
07-02-2007, 12:40 AM
Some important commmands:

ls - Lists contents of directories, "ls -ax" also lists hidden files and file permissions.

cd - Changes directory, "cd ~/Folder/" will take you to your users home directory and Folder.

su - Changes your current user to another user on the system, useful when installing files on peoples accounts or away from root.

nano - Good editor, exactly like pico.

yum - If your server supports it (may be apt-get), yum can be used to install any applications easily, but it may sometimes be better to compile your own.

tar -zxvf - Allows your to untar .tar.gz files.

When installing your own applications from source (normally .tar.gz), they come with INSTALL files which give you instructions, normally configure, make, make install.

Anything else can be covered by "man", the bash help system, e.g. "man cd" will give you help on changing directories.

gophp
07-02-2007, 03:29 AM
nano - Good editor, exactly like pico.

Beware of pico: it can screw up on lines longer than your terminal window can show. I think that can be solved by setting the terminal window size to max before starting the editor. But I prefer to use vi on the server for simple editing - knowing several commands is enough. Complex editing is better to do on your local machine with any software you like.