LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-25-2004, 04:30 PM   #1
MD3
Member
 
Registered: Apr 2004
Location: Italy
Distribution: Gentoo
Posts: 81

Rep: Reputation: 15
[SSH] Issue logging in [SSH & Permissions]



[root@pc1 root]# ssh -l user1 pc2
user1@pc2's password:
...MOTD...
/bin/bash: Permission denied
Connection to pc2 closed.
[root@pc1 root]#



[root@pc2 root]# chmod +rwxrwxrwx /bin/bash
[root@pc2 root]# cat /etc/passwd
...
user1:x:500:500:userN1:/home/user1:/bin/bash
[root@pc2 root]# cat /etc/groups
...
user1:x:500:
[root@pc2 root]#



[root@pc1 root]# ssh -l user1 pc2
user1@pc2's password:
/* MOTD... */
/bin/bash: Permission denied
Connection to pc2 closed.
[root@pc1 root]#


why can't i access /bin/bash? it is 777 and i got my own user and group.
Both PCs are with Red Hat 9

thanks everyone
 
Old 07-25-2004, 05:50 PM   #2
bastard23
Member
 
Registered: Mar 2003
Distribution: Debian
Posts: 275

Rep: Reputation: 30
Hmm... Here's some things to try

Your chmod command looks weird, try (chmod +rwxrwxrwx file doesn't work for me):
chmod 775 /bin/bash
You don't want your shell to be world writable. And make sure it's owned by root:root (or whatever Redhat installs it as)


# What's the permission on root and /bin?
root@pc2# ls -lad / /bin /bin/bash
# Are there any errors here?
root@pc2# su - user2
# is /bin/bash a real executable
user2@pc2$ file /bin/bash


Use the ssh debuging feature.
/etc/init.d/ssh stop;/usr/sbin/sshd -ddd
Then try logging in and see what is in the syslogs, as sshd will put out a bunch of stuff.

Good Luck,
chris
 
Old 07-25-2004, 08:53 PM   #3
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
Yeah, you for sure do not want to make your bash world writable. If you allow any kind of access, you'll be rooted faster than you can blink.

I think you've put something in your .bash_profile, .bashrc, or .profile that is trying to execute when a user logs in remotely and it's now allowed through an SSH connection. Presumably you can login locally without the permissions problem, right? So it's not a problem with bash, it's something in your profile or rc that cannot be run remotely.
 
Old 07-26-2004, 02:35 AM   #4
MD3
Member
 
Registered: Apr 2004
Location: Italy
Distribution: Gentoo
Posts: 81

Original Poster
Rep: Reputation: 15
this is what i did:


[root@pc2 root]# chmod 775 /bin/bash
[root@pc2 root]# ls -lad //bin /bin/bash
drwxrwxrwx 2 root root 4096 5 lug 22:50 //bin
-rwxrwxr-x 1 root root 626028 11 feb 2003 /bin/bash
[root@pc2 root]# su - user1
su: /bin/bash: Permission denied
[root@pc2 root]# file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped
[root@pc2 root]#


it still doesn't work

thanks all
 
Old 07-26-2004, 02:36 AM   #5
MD3
Member
 
Registered: Apr 2004
Location: Italy
Distribution: Gentoo
Posts: 81

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by chort
...
Presumably you can login locally without the permissions problem, right?
no
 
Old 07-26-2004, 11:49 AM   #6
bastard23
Member
 
Registered: Mar 2003
Distribution: Debian
Posts: 275

Rep: Reputation: 30
OK,

Try checking the permissions on your libraries:
ls -la /lib /lib/ld-* /lib/libc*
The files should probably be 755 (-rwxr-xr-x), and you should check the permissions on the other libraries that bash depends on ("ldd /bin/bash" to see what they are)

Good Luck,
chris
 
Old 07-26-2004, 02:19 PM   #7
MD3
Member
 
Registered: Apr 2004
Location: Italy
Distribution: Gentoo
Posts: 81

Original Poster
Rep: Reputation: 15


i set 775 all the libraries that appeared with


[root@pc2 root]# ldd /bin/bash
libtermcap.so.2 => /lib/libtermcap.so.2 (0x40023000)
libdl.so.2 => /lib/libdl.so.2 (0x40027000)
libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
[root@pc2 root]#


but it still doesn't work ...

thanks all
 
Old 07-26-2004, 07:51 PM   #8
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
So clearly, this isn't a RH 9 problem, but rather something that you did to RH 9 out of the ordinary that broke it. First of all, fix your permissions back to where they should be. There's no way in hell that /bin should be world writable. Endlessly chmod'ing random things to 777 isn't going to fix or identify the problem.

What will identify the problem is if you recall everything that you've done to the box since you originally installed the software. I still maintain that there's a strong possibility that you have something being called in the user login scripts (.profile, .*rc, etc) that is causing the error. Perhaps you've changed the attributes on some of your partitions to have noexec. Perhaps you've installed a kernel patch of some sort for security, like grsec or openwall. There must be something you did to the system to cause this problem, because a default install of RH does not behave like that.

The fastest way to figure out this problem is for you to make a list of everything you changed. For us, there are an infinite amount of things we could suggest for you to check, but it's all going to be guesses and it could screw up your system more (like chmod'ing everything to 777).
 
Old 07-27-2004, 05:17 AM   #9
MD3
Member
 
Registered: Apr 2004
Location: Italy
Distribution: Gentoo
Posts: 81

Original Poster
Rep: Reputation: 15
ok.. assuming that i'm sure i didn't do anything with files i didn't know like the ".profile" you said .. is there any way to reset the permission-ralated settings?

thanks
 
Old 07-30-2004, 05:36 AM   #10
holtet
LQ Newbie
 
Registered: Jul 2004
Location: Norway
Distribution: mandrake,redhat,rocks
Posts: 1

Rep: Reputation: 0
Hi,

Found this thread while having a similar problem myself. Tourned out a simple chmod go+rx / solved it. Still don't know what caused the problem... Might be worth a try.
 
Old 07-31-2004, 04:46 AM   #11
MD3
Member
 
Registered: Apr 2004
Location: Italy
Distribution: Gentoo
Posts: 81

Original Poster
Rep: Reputation: 15
still doesn't work....

thank you
 
Old 12-10-2006, 09:25 AM   #12
kozaki
Member
 
Registered: Jun 2004
Location: France, UE
Distribution: Arch Linux, Bodhi, Debian, Mageia, OpenMediaVault, Q4OS
Posts: 133

Rep: Reputation: 20
Thumbs up

Like holtet I found this thread after beeing unable to log as a user on my serveur, with ssh as well as localy.
It appears I made sthg like "#chmod 750 \.* /home/user/" ... ~#-|
But this happened just when someone was tempting brute force passwd attack on this machine (1), so I'm glad I still thought it was me who caused the problem and checked it the right way thanks to bastard23 advice

(1)
Code:
Failed password for invalid user rpc from 221.130.113.xx port 3329 ssh2
Dec 10 03:58:53 xxxxxx sshd[29010]: Invalid user gopher from 221.130.113.xx
Dec 10 03:58:53 xxxxxx sshd(pam_unix)[29010]: check pass; user unknown
Dec 10 03:58:53 xxxxxx sshd(pam_unix)[29010]: authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.130.113.xx
Dec 10 03:58:55 xxxxxx sshd[29010]: Failed password for invalid user gopher from 221.130.113.xx port 3496 ssh2
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
SSH - Logging out r4merlin Linux - Networking 1 11-02-2003 12:50 PM
logging onto SSH robmainella Linux - Newbie 5 08-26-2003 02:21 PM
ssh issue: /usr/bin/ssh -x -oFallBackToRsh no -l WeNdeL Linux - Software 1 03-04-2003 07:17 PM
ssh & /etc/issue Ratclaws Linux - Networking 2 02-21-2003 02:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:42 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