LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-27-2009, 01:08 AM   #1
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Rep: Reputation: 15
Pls help: unable to login as normal user through ssh


Hi

When I am trying to login to a remote server(public ip) through ssh using linux terminel or putty, i can log through root user but unable to login through normal user.Its showing connection refused by remote server.
Iptables and selinux is disabled in remote server.

Pls help me to sort it out.
 
Old 02-27-2009, 02:38 AM   #2
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
Pls help, its urgent
 
Old 02-27-2009, 02:55 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
how are you trying to connect?
Code:
ssh user@xxx.xxx.xxx.xxx ?

BTW, disable root login at the remote server.

Last edited by repo; 02-27-2009 at 02:57 AM.
 
Old 02-27-2009, 03:00 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Baps View Post
When I am trying to login to a remote server(public ip) through ssh using linux terminel or putty, i can log through root user but unable to login through normal user. Its showing connection refused by remote server.
That's bad.


Quote:
Originally Posted by Baps View Post
Iptables and selinux is disabled in remote server.
That's bad as well. Both should be enabled but lets deal with the SSH daemon first.

* Enable a backup access solution.
If you feel you won't be able to complete the task without making errors (and who doesn't at times), ensure you can access the system still. Here is an example in case Xinetd is installed and running. Run 'cp /etc/ssh/sshd_config /etc/ssh/sshd_config_xinetd", then create a file "/etc/xinetd.d/ssh-backup" with the following contents:
Code:
# default: on
# description: The ssh-backup service allows you to connect to your system
#       using ssh on port 2022 even when the ssh daemon isn't running.
#       of course it requires your config to be *sane* ;-p
#       * Change the "10.0.0.0/24" range to your IP address or range.
#       ** Do test if you get access.
service ssh-backup
{
        disable = no
        socket_type     = stream
        protocol        = tcp
        port            = 2022
        type            = UNLISTED
        wait            = no
        user            = root
        server          = /usr/sbin/sshd
        server_args     = -i -b 1024 -u0 -4 -f /etc/ssh/sshd_config_xinetd
        log_on_failure  += USERID
        only_from       = 10.0.0.0/24
}
Now restart Xinetd and see if you can access the server on port TCP/2022.


* Enable restore on fsck-up.
Each time you work on a configuration file there is a risk of fscking up. With servers you don't have physical access to that'll be kind of a bummer because then you'll need remote access otherwise (any web-based panel) or ask your colo crew to restore things. One easy way to avoid all of that is the make backups and restore them automagically.
For example if you're working on the SSH daemon configuration file you could:
Code:
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.1
echo 'cp -f /etc/ssh/sshd_config.1 /etc/ssh/sshd_config; service sshd restart'|/usr/bin/at $(date +%H:%M --date="+1 hour")
This example gives you exactly 1 hour to make changes work before restoring the old config. if all worked OK then you just remove the at job:
Code:
# List jobs
atq
# Say the job is number 1, to remove:
atrm 1

* Ensure unprivileged account access to the SSH service on the machine.
You need to make sure you have an unprivileged account on the machine that is allowed to access it over the network. Access the system as root account user. If the user account you try to login with exists and should be allowed access then check the systems logs to find out why login is refused. Else see /etc/pam.d for ssh* configuration with non-standard options. Else if all looks OK, see if the sshd_config already disabled password access and requires an authentication key instead. Else see if creating a new user works.
If unsure just post *exact* error messages, configuration file contents.


* Ensure unprivileged account access to root on the machine.
Because you need to maintain the machine you need root account access. Most of the time you'll be performing single tasks. For that installing Sudo is a good choice.
Search the LQ Linux Answers for a HOWTO or read for instance directions at http://www.linuxhomenetworking.com/w...Users_and_Sudo
If unsure post your /etc/sudoers configuration file before enabling it.


* Ensure root can't access SSH on the machine.
Search the LQ Linux Answers for a HOWTO or read for instance directions at http://www.puschitz.com/SecuringLinux.shtml#SecuringSSH.


* Ensure the firewall flters traffic.
Even inside a LAN having a firewall is advisable. Not only does it help with access control and routing traffic but can also serve as a diagnostic and auditing tool and addressing Single Point of Failure.
Search the LQ Linux Answers for a HOWTO or read for instance directions at http://www.linuxhomenetworking.com/w...Using_iptables
If unsure post your firewall script or configuration file before executing it.


This should get you started I hope. If unsure just read *then* post questions. SE Linux, more service protection (especially SSH) can be addressed later on in a new thread. And if you used the Xinetd backup SSHd please don't forget to sync the final configuration changes or else you'll still have a loophole.
 
Old 02-27-2009, 03:06 AM   #5
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
yes, through linux terminel i m trying as
ssh user@xxx.xxx.xxx.xxx
 
Old 02-27-2009, 03:11 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
and the user exist on the remote machine, right ?
 
Old 02-27-2009, 03:18 AM   #7
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
yes
myself created the user after logging as root
 
Old 02-27-2009, 03:45 AM   #8
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
Hi Repo
Pls suugest wht to check next

Hi unSpawn

Its a server on remote location and I only given the task of creating user and allow ssh access, so I can not experiment with all the things you said.However I feel giving ssh access to a normal user is simple.But there must be some setting for which I am unable to figure out
 
Old 02-27-2009, 04:45 AM   #9
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
pls suggest
 
Old 02-27-2009, 05:01 AM   #10
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
take a look in the logfiles for any pointers why it is refused
how did you created the user?
which distribution are you using?
 
Old 02-27-2009, 05:10 AM   #11
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
try this
adduser <username>
passwd <username>
-> follow prompts
 
Old 02-27-2009, 05:14 AM   #12
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
i checked the log file /var/log/secure, its showing something like pam_unix authentication error.

At first I logged as root user to the server then created the user.

I am using centos 5.1
 
Old 02-27-2009, 05:40 AM   #13
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
try this
adduser <username>
passwd <username>
-> follow prompts
 
Old 02-27-2009, 05:44 AM   #14
Baps
LQ Newbie
 
Registered: Feb 2009
Posts: 25

Original Poster
Rep: Reputation: 15
i created the user and password like this
it showing the user under /home
 
Old 02-27-2009, 05:56 AM   #15
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
could you post your
/etc/ssh/sshd_config file?
also give the exact errormessages.

Did you checked the post unSpawn gave you?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to login as normal user adityavpratap Ubuntu 2 06-22-2007 05:20 AM
[Konqueror] unable to internet as normal user grezly SUSE / openSUSE 1 05-31-2007 08:56 AM
ssh login with normal user, receive: /dev/null: Permission denied mark78301 Red Hat 3 11-12-2005 09:20 AM
Unable to play DVD as normal user . LQer928 Slackware 10 07-05-2005 08:37 AM
How to login as a normal user? daYz Slackware 5 11-14-2003 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration