Baffled by problems with ssh and samba | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Baffled by problems with ssh and samba

UNIX for Dummies Questions & Answers


Tags
copy-id, faq, fresh start, samba install, ssh

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-06-2013
Royalist Royalist is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 21 June 2014, 8:09 AM EDT
Location: Cornwall UK
Posts: 51
Thanks: 6
Thanked 2 Times in 1 Post
Network Baffled by problems with ssh and samba

I have made a complete botch of trying to install both ssh and samba, having followed numerous tutorials - all claiming to be easy to follow and stating that it is easy.
The last attempt @ ssh was going really well until the copy id stage

Code:
roy@roy-1011PX:~$ ssh-copy-id -i /home/roy/.ssh/id_dsa.pub roy@192.168.1.xx     # (this is the desktop/server IP)

 Permission denied (publickey,keyboard-interactive).

This has been going on and off for many weeks and so what I now want to do is to achieve is a clean slate and a fresh start.

I have just a netbook and a desktop running on Ubuntu 11.10 and 12.04(desktop)

Please can anybody suggest a simple and certain way of achieving this and please without missing out even the basics e.g. the sudo command - PLEASE PLEASE!!

Moderator's Comments:
edit by bakunin: corrected your code-tags.

Last edited by bakunin; 01-06-2013 at 07:11 AM..
Sponsored Links
    #2  
Old 01-06-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 21 September 2014, 1:14 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,251
Thanks: 45
Thanked 817 Times in 644 Posts
hmm....

Here is a short How-To for ssh:

ssh (secure shell) is a replacement for remote terminal programs like "telnet", "rlogin", etc.. The difference to telnet is that the whole communication is encrypted so even if it is intercepted an intruder cannot gain anything from it.

Like telnet too it consists of two parts: a server- and a client-part. The client part initiates the communication. It is the program you call when you issue


Code:
ssh user@host

The server part is named "sshd". You can find it in the process list by issuing


Code:
# ps -fe | grep sshd
root       987     1  0 Jan02 ?        00:00:00 /usr/sbin/sshd -D
bakunin  16163 16153  0 13:24 pts/0    00:00:00 grep sshd

The server part will take the incoming communication requests and handle them.

The first thing you need to do is to configure the server part on a machine you want to connect to. This is done in the file "/etc/sshd_config" and you can find numerous examples for a simple yet working configuration. You need a startup routine so that "sshd" is started automatically at system startup (depends on the system), but for a first test it suffices to issue


Code:
# /usr/sbin/sshd -D

as user root, which starts it in background.

Now let us consider we have two systems with a running server process and we want to connect from one to the other. We simply issue


Code:
user1@host1 # ssh user2@host2

and if everything is running correctly we are greeted with a login prompt and asked for a password ("user2" has to exist of course).

Because we would not want to enter the password every time we connect we can "create" and "exchange" keys: instead of passwords you can generate key sequences and put these on the other server. These keys reside in the directory "~/.ssh" (per default), which will be created when you generate such a key. Switch to the user you want to use and issue


Code:
user1@host # ssh-keygen

and follow the prompts leaving everything at default. Use "RSA" as encryption mechanism. DO NOT enter a password when asked but instead press "ENTER". You will see some files in this directory now:


Code:
user1@host1 # ls -l .ssh 
total 24
-rw-------. 1 user1 staff 1679 Dec 17  2008 id_rsa
-rw-r--r--. 1 user1 staff  408 Dec 17  2008 id_rsa.pub
-rw-r--r--. 1 user1 staff 2112 Nov 22 14:15 known_hosts

The file "id_rsa.pub" is your public key. Suppose you want to connect from host "host2" as user "user2" to this host as user "user1". Open another window in which you connect to "host2" as "user2". Then create a file "~/.ssh/authorized_keys" into which you paste the contents of the aforementioned file "id_rsa.pub"



Code:
# ssh user2@host2
user2@host2 # scp user1@host1:~/.ssh/id_rsa.pub /tmp/key
user2@host2 # cat /tmp/key >> ~/.ssh/authorized_keys
user2@host2 # chmod 600 ~/.ssh/authorized_keys

You are now able to remotely log in to "host1" as "user1" from here. If you want to be able to connect to another host as another user (or even the same host as another user) you have to create a keyfile with this other user and put it also into the file "authorized_keys". This file can hold as many keys as you want, you just put one after the other.

Note that if user1@host1 is allowed to connect to "host2" as "user2", this does not mean that the other direction is allowed to. "user2@host2" will still have to enter the password if he wants to connect to "host1" as "user1" - you will again have to create the key file and put it in the file "authorized_keys" of the other user to enable passwordless login in the other direction.

I hope this helps.

bakunin
The Following 2 Users Say Thank You to bakunin For This Useful Post:
jim mcnamara (01-06-2013), Scott (01-08-2013)
Sponsored Links
    #3  
Old 01-08-2013
Royalist Royalist is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 21 June 2014, 8:09 AM EDT
Location: Cornwall UK
Posts: 51
Thanks: 6
Thanked 2 Times in 1 Post
Please keep it simple No code tags as Firefox shuts down

Thank very much for your prompt reply.


I think that you are assuming that I am more advanced than is the fact.



Code:
ssh roy@192.168.1.xx (host IP)
 

 Did that on client.  
 

 Result: ”ssh: connect to host 192.168.1.xx port 22: Connection refused”
 

 # ps -fe | grep sshd
 

 Did that without the # and this was the result:
 roy       2573  2517  0 16:19 pts/0    00:00:00 grep --color=auto sshd 
 

 Yours was:
 root       987     1  0 Jan02 ?        00:00:00 /usr/sbin/sshd -D
 bakunin  16163 16153  0 13:24 pts/0    00:00:00 grep sshd
 

 So I need to chown ownership to root, but I do not understand the significance of the other differences. It's a bit too advanced for me.
 

 Shall I send you the current contents of /etc/ssh/sshd_config??
 

 sudo /usr/sbin/sshd -D
 

 Did that on desktop/server, but no result, had to stop it in the end with 'cntrl C'
 

 roy@192.168.1.xx (client IP) # ssh roy@182.168.1.xx (server IP)
 

 Did that: 'command not found'
 

 roy@192.168.1.xx (client IP) # ssh roy@192.168.1.xx (server IP)
 

 Did that on netbook client i.e. user1@host1 user2@host2  i.e. desktop server
 

 'command not found'
 

 roy@192.168.1.xx # ssh-keygen

did that on netbook with and without the # : - command not found.


I don't see any point in going further at this stage.


CAN YOU TELL ME PLEASE HOW TO WIPE THE SLATE CLEAN and to make a fresh start in language a genuine newbie can understand.
    #4  
Old 01-08-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 21 September 2014, 1:14 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,251
Thanks: 45
Thanked 817 Times in 644 Posts
To be honest i am not sure if i can simplify the matter any further. A certain minimum of knowledge is necessary if you want to do any - even the most basic - act of system administration.

Quote:
Originally Posted by Royalist View Post

Code:
ssh roy@192.168.1.xx (host IP)

Did that on client.

Result: ”ssh: connect to host 192.168.1.xx port 22: Connection refused
OK. This might have several reasons:

1. The server process doesn't run on the system you want to connect to. For a working connection you need the client program on your local system and the server part on your remote system.

2. The server part tuns but listens to another port. 22 is the default port, but sshd can be configured to use another one instead.

3. The user ID you use ("roy") is not allowed to log on to the system.

4. Maybe some other reason i forgot.

Quote:
Originally Posted by Royalist View Post
Code:
# ps -fe | grep sshd

Did that without the # and this was the result:

Code:
roy       2573  2517  0 16:19 pts/0    00:00:00 grep --color=auto sshd

First off: what you see here is not the sshd process, but the grep, which of course finds itself running. My example has 2 lines of output as you can see: the running "sshd" and the "grep". Yours has only the "grep" which means, "sshd" is not running at all.

Furthermore, you probably issued this on your client. As said above the server part needs to run on the remote system, not your local one.

Quote:
Originally Posted by Royalist View Post
Code:
sudo /usr/sbin/sshd -D

Did that on desktop/server, but no result, had to stop it in the end with 'cntrl C'
What do you mean by "no result"? Was there any output? Did you try to connect to the system while this process was running? Did you still get the "connection refused" error in this time?



Quote:
Code:
roy@192.168.1.xx (client IP) # ssh roy@182.168.1.xx (server IP)

Did that: 'command not found'
Please note: The "#" is the command prompt. Yours probably looks different. When i write:


Code:
user1@host1 # /some/command

i simply mean: become user "user1" at host "host1", then issue "/some/command" on the command line.

Quote:
CAN YOU TELL ME PLEASE HOW TO WIPE THE SLATE CLEAN and to make a fresh start in language a genuine newbie can understand.
Sorry, but i can't. I can't explain someone the difference between "dark green" and "light green" who was blind from birth either. There is a certain minimum of knowledge about computers and how computers work necessary to at least understand and carry out basic commands. The best advice i can give you is: get someone knowledgeable to install it for you - or get the knowledge yourself. Both won't be possible over the net in a forum.

I hope this helps.

bakunin
Sponsored Links
    #5  
Old 01-12-2013
Royalist Royalist is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 21 June 2014, 8:09 AM EDT
Location: Cornwall UK
Posts: 51
Thanks: 6
Thanked 2 Times in 1 Post
The end of the tunnel is in sight

I have the ssh daemon running.

Code:
roy@roy-desktop:~$ ps -fe | grep sshd
root      3811     1  0 13:57 ?        00:00:00 /usr/sbin/sshd -D
roy       3818  3007  0 13:59 pts/0    00:00:00 grep --color=auto sshd

Thank you very much for spending so much time on what you clearly thought was a hopeless case.
I do appreciate your quaint turn of phrase:
Quote:
explain someone the difference between "dark green" and "light green" who was blind from birth either
However, I don't give up that easily. You maybe surprised to know that I have been learning (by using it) Linux terminal commands for more than a year and I have had a number of years of experience of other systems and computers in general.
It has taken many hours to reach this point and I am taking a break now, but will perservere later in following your later instructions. If you wish to be informed?
Again, very many thanks!!!
Sponsored Links
    #6  
Old 01-15-2013
jmanel jmanel is offline
Registered User
 
Join Date: Jul 2010
Last Activity: 15 January 2013, 5:33 AM EST
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
I would suggest you to not blindly follow tutorials you find on the net.
Try to understand what they are doing and apply to your system only if you understand what they are doing.
Obviously you can fresh start by getting a dvd from ubuntu and reinstalling your system, but take into account that perhaps some of the hardware not being recognized by default. In that case you will need someone to help you to get you system working another time.
Sponsored Links
    #7  
Old 01-15-2013
Royalist Royalist is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 21 June 2014, 8:09 AM EDT
Location: Cornwall UK
Posts: 51
Thanks: 6
Thanked 2 Times in 1 Post
Getting there

Yes, I have learnt that the hard way. There is so much conflicting advice. I have now begun to understand better the 'man' pages which is a great help and now have a working
Code:
sshd_config and ssh_config

files.
I have found that setting LogLevel to debugg2 a great help.
I am now working on finding ways of transferring the pubkey. I think it will be necessary to temporarily allow password authentication to achieve that. Any comments on that please, or anything else?
Thanks for your advice.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Samba 3.6.5 install problems mattymatt79 Solaris 6 06-14-2012 01:13 PM
Installing SAMBA problems audis$ AIX 2 02-19-2012 08:13 PM
Problems between a HP UX 11.31 Samba share and Windows 7... zixzix01 UNIX for Advanced & Expert Users 1 04-22-2011 01:48 PM
samba PROBLEMS norsk hedensk UNIX for Dummies Questions & Answers 4 07-08-2002 08:35 PM



All times are GMT -4. The time now is 02:13 AM.