LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   [SSH] Issue logging in [SSH & Permissions] (https://www.linuxquestions.org/questions/linux-networking-3/%5Bssh%5D-issue-logging-in-%5Bssh-and-permissions%5D-209553/)

MD3 07-25-2004 04:30 PM

[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 :)

bastard23 07-25-2004 05:50 PM

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

chort 07-25-2004 08:53 PM

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.

MD3 07-26-2004 02:35 AM

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 :cry:

thanks all

MD3 07-26-2004 02:36 AM

Quote:

Originally posted by chort
...
Presumably you can login locally without the permissions problem, right?
no
:(

bastard23 07-26-2004 11:49 AM

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

MD3 07-26-2004 02:19 PM

:cry: :cry: :cry:

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

chort 07-26-2004 07:51 PM

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).

MD3 07-27-2004 05:17 AM

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

holtet 07-30-2004 05:36 AM

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.

MD3 07-31-2004 04:46 AM

still doesn't work.... :(

thank you

kozaki 12-10-2006 09:25 AM

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



All times are GMT -5. The time now is 07:14 AM.