Can not connect to terminal with any user
So I want to use screen to run a program, but I can only connect to the terminal with root. If I try to connect with a user it just keeps saying access is denied. I have setup 1 user and password and I can su to the user but screen wont work that way. I have changed the password multiple times and I know I'm typing the right password in but it still will not let me connect unless I am logging in with root.
Edit: I forgot to add that I am running CentOS 6. |
Edit: here is the commands I used to make the username "mike"
[root@server ~]# useradd mike [root@server ~]# passwd mike Changing password for user mike. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@server ~]# |
Would you please give the commands that you entered?
Your description is misleading. On the one hand you say you want to use screen on the other you say that you can't connect to terminal. login with the user name who is running the screen session. Issue "screen -ls" and you can see how many sreen sessions are running. If only one is running you can connect to it with "screen -x" If there are more you have to use the name or pid:name showed by -ls Something like "screen -x -S name" or "screen -x -S pid:name" But I'm not sure whether you are talking from that at all. |
I'm sorry for being misleading, but my problem is I can only connect to the terminal with root, but I need to connect with my username "mike" to use screen because the program I want to run is in the home directory under that user name. So I can connect to the terminal with root but not "mike". I also know how to use screen. So when I go to the terminal here is what it says.
login as: mike mike@xxx.141.254.50's password: Access denied mike@xxx.141.254.50's password: but when I login as root it works perfectly fine. |
Well, root can run every programm.
And root can "su mike" without beeing prompted for a password. something is wrong with the account of "mike". As root you can can correct this. Do you use "ssh" to connect to the machine? "su" stands for SubstituteUser |
I use the program putty to connect remotely. This is a dedicated server service. I can not run screen when I login as root and and su to mike here is the terminal entry when I do that.
[root@server ~]# [root@server ~]# su mike [mike@server root]$ screen Cannot open your terminal '/dev/pts/0' - please check. [mike@server root]$ |
When you use putty have you tried to login with mike? What happens.
As root run the following commands and post their output: cat /etc/passwd ls -l /home id mike |
[root@server ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin news:x:9:13:news:/etc/news: uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin nscd:x:28:28:NSCD Daemon:/:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin pcap:x:77:77::/var/arpwatch:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin avahi:x:70:70:Avahi daemon:/:/sbin/nologin rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin apache:x:48:48:Apache:/var/www:/sbin/nologin oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin haldaemon:x:68:68:HAL daemon:/:/sbin/nologin avahi-autoipd:x:100:156:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin webapps:x:500:500::/var/www/html:/bin/false named:x:25:25:Named:/var/named:/sbin/nologin diradmin:x:101:157::/usr/local/directadmin:/bin/false mysql:x:102:158:MySQL server:/var/lib/mysql:/bin/false majordomo:x:103:2::/etc/virtual/majordomo:/bin/false dovecot:x:104:104::/home/dovecot:/bin/false admin:x:501:501::/home/admin:/bin/bash mike:x:502:503::/home/mike:/bin/bash gdm:x:42:42::/var/gdm:/sbin/nologin [root@server ~]# ls -l /home total 36 drwx--x--x 7 admin admin 4096 Feb 20 20:06 admin drwxr-xr-x 2 root root 4096 Dec 9 2010 ftp drwx------ 26 mike mike 4096 Feb 21 18:53 mike drwx------ 4 503 504 4096 Feb 21 19:35 test drwxrwxrwt 2 root root 4096 Feb 21 00:10 tmp [root@server ~]# id mike uid=502(mike) gid=503(mike) groups=503(mike) |
What is this box running?
Which version? What services this box offers? And i would correect the login problem of user mike instead of starting screen. It is never a good idea to even let root login from remote site. |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Which services does this machine offer?
It offers a ssh as you log in with Putty, I think. Is there a web server running? All kind of servers I'd like to know. It got a strange layout at /home anyway.. First try to log in as root and change the password for mike Code:
passwd mike If it doesn't help, log in again as root and do this: Code:
cat /etc/pam.d/passwd |
[root@server ~]# cat /etc/pam.d/passwd
#%PAM-1.0 auth include system-auth account include system-auth password include system-auth [root@server ~]# Changing my password did not work, it still says access is denied when I try to login. |
So the problem seems to be merely a sshd conf issue.
What kind of authentication is this server using? in other words: what is the __exact__ command Putty uses to log in as root? And please paste the config of sshd. It has been working so who or what changed something. What activities did occur when it stopped working? |
Quote:
Code:
[root@server ~]# chkconfig --list |
Quote:
How do I view the sshd config? I have only had the server for a dew days and the server service setup everything up except the vnc server I did that. As long as I had the server I've had this issue. |
Quote:
cat /etc/ssh/sshd_config |
Code:
[root@server ~]# cat /etc/ssh/sshd_config |
So this server has a control panel called directadmin. I've never used a control panel before and could this be the reason why I've been having so many issues with my users?
|
Edit the /etc/ssh/sshd_config file and add:
AllowUsers mike Also, you should not allow root to log in via ssh, to stop it (ONLY IF MIKE WORKS) change this line: #PermitRootLogin yes to PermitRootLogin no ---------- Post added 02-22-12 at 09:13 PM ---------- Quote:
AllowUsers admin Also, there is a user called "admin" in your /etc/passwd file. The UID is 501 so it was the first user created (after root): admin:x:501:501::/home/admin:/bin/bash |
Quote:
and the username admin also does not work I already tried to login to that user and I changed the password for admin and still nothing. |
OH MY!!! IT WORKS!!! finnaly!!! thank you so much! but I'm still curious about my question above how would I get root access if I disable ssh for root?
EDIT: oh and I guess I was just putting the wrong password in for admin because it worked right after I changed it. |
Disabling SSH for root just means root can not log in "remotely". Once you log in as Mike you can use the following command to "become" root.
su - You will be prompted for the root password after issuing the above command. |
Quote:
|
I'm not sure if this helps but I believe it was the original problem.
I hope I read this right. http://www.cyberciti.biz/tips/linux-...to-system.html |
Wow, late to the party, but I figured I'd comment on this. I was looking at your useradd commands, and it appears that you might not have created a home directory for your user. Can you verify if a user directory was created in /home(or wherever you have home directories). useradd -m $USERNAME will create a new account AND a new home directory for that user in the default location. This may be related to your problem(but you probably already have it figured out by now).
|
Quote:
|
All times are GMT -5. The time now is 11:13 PM. |