I have set ulimit for open files on my centos machine by editing /etc/security/limits.conf post which I am unable to login into the machine.  This was the change made in /etc/security/limits.conf file.    nofiles unlimited    A tail of verbose output of my ssh login is as follows.  debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 debug2: channel 0: rcvd eow debug2: channel 0: close_read debug2: channel 0: input open -&gt; closed debug2: channel 0: rcvd eof debug2: channel 0: output open -&gt; drain debug2: channel 0: obuf empty debug2: channel 0: close_write debug2: channel 0: output drain -&gt; closed debug2: channel 0: rcvd close debug3: channel 0: will not send data after close debug2: channel 0: almost dead debug2: channel 0: gc: notify user debug2: channel 0: gc: user detached debug2: channel 0: send close debug2: channel 0: is dead debug2: channel 0: garbage collecting debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open:   #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cfd -1)  debug3: channel 0: close_fds r -1 w -1 e 6 c -1 debug3: Wrote 32 bytes for a total of 2229 debug3: Wrote 64 bytes for a total of 2293 Connection to 172.16.47.108 closed. Transferred: sent 2096, received 2528 bytes, in 0.0 seconds Bytes per second: sent 91488.9, received 110345.4 debug1: Exit status 254   A ping to the machine works fine and give back replies. Then why is my ssh connection getting terminated.
123056
I need to start by stating that I have read through every single problem on here relating to mine, but all of them seem to have access somehow to their server's files. I do not, so here is my question.  I'm on centOS 6.5 and ssh closes connection right after a successful login. I am using mac and windows/putty to access my server with the same results. Is there anyway I can access my server now without having access to its files?   Below is the readout from ssh -vvv right after a successful login:  debug1: Authentication succeeded (password). Authenticated to 4X.5X.XX.2 ([4X.5X.XX.2]:82). debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug2: channel 0: send open debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug2: callback start debug2: fd 3 setting TCP_NODELAY debug3: ssh_packet_set_tos: set IP_TOS 0x10 debug2: client_session2_setup: id 0 debug2: channel 0: request pty-req confirm 1 debug1: Sending environment. debug3: Ignored env TERM_PROGRAM debug3: Ignored env SHELL debug3: Ignored env TERM debug3: Ignored env TMPDIR debug3: Ignored env Apple_PubSub_Socket_Render debug3: Ignored env TERM_PROGRAM_VERSION debug3: Ignored env TERM_SESSION_ID debug3: Ignored env USER debug3: Ignored env SSH_AUTH_SOCK debug3: Ignored env __CF_USER_TEXT_ENCODING debug3: Ignored env PATH debug3: Ignored env PWD debug1: Sending env LANG = en_US.UTF-8 debug2: channel 0: request env confirm 0 debug3: Ignored env XPC_FLAGS debug3: Ignored env XPC_SERVICE_NAME debug3: Ignored env SHLVL debug3: Ignored env HOME debug3: Ignored env LOGNAME debug3: Ignored env _ debug2: channel 0: request shell confirm 1 debug2: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel_input_status_confirm: type 99 id 0 debug2: PTY allocation request accepted on channel 0 debug2: channel 0: rcvd adjust 2097152 debug2: channel_input_status_confirm: type 99 id 0 debug2: shell request accepted on channel 0 Last login: Wed Oct  7 06:23:21 2015 from 1XX.XXX.X1.185 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 debug2: channel 0: rcvd eow debug2: channel 0: close_read debug2: channel 0: input open -&gt; closed debug2: channel 0: rcvd eof debug2: channel 0: output open -&gt; drain debug2: channel 0: obuf empty debug2: channel 0: close_write debug2: channel 0: output drain -&gt; closed debug2: channel 0: rcvd close debug3: channel 0: will not send data after close debug2: channel 0: almost dead debug2: channel 0: gc: notify user debug2: channel 0: gc: user detached debug2: channel 0: send close debug2: channel 0: is dead debug2: channel 0: garbage collecting debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open:   #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)  Connection to 4X.5X.XX.2 closed. Transferred: sent 3176, received 2640 bytes, in 0.3 seconds Bytes per second: sent 10370.6, received 8620.4 debug1: Exit status 254
91773
When using ss with -p option, user/pid/fd column jumps underneath the particular line. For instance this is it what I'm actually seeing:  # ss -nulp4 State      Recv-Q Send-Q                                           Local Address:Port                                             Peer Address:Port  UNCONN     0      0                                                            *:20000                                                       *:*       users:(("perl",pid=9316,fd=6)) UNCONN     0      0                                                            *:10000                                                       *:*       users:(("perl",pid=9277,fd=6)) UNCONN     0      0                                               192.168.100.10:53                                                          *:*       users:(("named",pid=95,fd=517),("named",pid=95,fd=516)) UNCONN     0      0                                                    127.0.0.1:53                                                          *:*       users:(("named",pid=95,fd=515),("named",pid=95,fd=514))   Preferred output formatting:  # ss -nulp4 State      Recv-Q Send-Q                                           Local Address:Port                                             Peer Address:Port  UNCONN     0      0                                                            *:20000                                                       *:*      users:(("perl",pid=9316,fd=6)) UNCONN     0      0                                                            *:10000                                                       *:*      users:(("perl",pid=9277,fd=6)) UNCONN     0      0                                               192.168.100.10:53                                                          *:*      users:(("named",pid=95,fd=517),("named",pid=95,fd=516)) UNCONN     0      0                                                    127.0.0.1:53                                                          *:*      users:(("named",pid=95,fd=515),("named",pid=95,fd=514))   To confirm that there are no line breaks I've tried this:  # ss -nulp4 | cat -A State      Recv-Q Send-Q        Local Address:Port          Peer Address:Port $ UNCONN     0      0                         *:20000                    *:*      users:(("perl",pid=9316,fd=6))$ UNCONN     0      0                         *:10000                    *:*      users:(("perl",pid=9277,fd=6))$ UNCONN     0      0            192.168.100.10:53                       *:*      users:(("named",pid=95,fd=517),("named",pid=95,fd=516))$ UNCONN     0      0                 127.0.0.1:53                       *:*      users:(("named",pid=95,fd=515),("named",pid=95,fd=514))$   And indeed you can see that there were none, but now, strangely enough, output format is the way I've wanted it to be. Could someone explain what's going on here? How can I achieve my preferred formatting?  This is the only thing stopping me from migrating from netstat to ss.
91963
My /etc/ssh/sshd_config file has a line like:  AllowUsers jim@11.22.33.456   If I want to allow jim to use another IP addresses, how do I specify it?   Does it take the form of a comma separated list? Or, do add a similar line like   AllowUsers jim@new-ip-address   ?
59578
It took me hours to solve this SSH problem with one of my class accounts on my school's servers.    I couldn't ssh into one particular class account without entering my password, while passwordless authentication worked with my other class accounts. The .ssh/ directory and all of its contents had the same, correct permissions as the other class accounts.   Turns out the problem was the permissions set on my own home directory. Passwordless authentication did not work when the permissions on my HOME directory were set to 770 (regardless of the permissions set for .ssh/), but it worked with permissions set to 755 or 700.   Anyone know why SSH does this? Is it because the home directory permissions are too permissive? Why does SSH refuse to authenticate with the public/private keys when the home directory is set more permissive than 700?
84464
Is there any way to configure a user on a Linux box (Centos 5.2 in this case) so that they can use scp to retrieve files, but can't actually login to the server using SSH?
4716
[root@datacenteronline ~]# ssh root@192.168.1.172 Last login: Wed Apr 17 09:55:45 2013 from 192.168.1.187 [root@localhost ~]# ls /proc/ | grep 2266 [root@localhost ~]# cd /proc/2266 [root@localhost 2266]# ls attr             cpuset   limits      net            root       statm autogroup        cwd      loginuid    numa_maps      sched      status auxv             environ  maps        oom_adj        schedstat  syscall cgroup           exe      mem         oom_score      sessionid  task clear_refs       fd       mountinfo   oom_score_adj  smaps      wchan cmdline          fdinfo   mounts      pagemap        stack coredump_filter  io       mountstats  personality    stat [root@localhost 2266]# ls -al /proc/2266 total 0 dr-xr-xr-x   7 apache apache 0 Apr 17 09:45 . dr-xr-xr-x 266 root   root   0 Apr 17 09:11 .. dr-xr-xr-x   2 apache apache 0 Apr 17 09:45 attr -rw-r--r--   1 root   root   0 Apr 17 09:45 autogroup -r--------   1 root   root   0 Apr 17 09:45 auxv -r--r--r--   1 root   root   0 Apr 17 09:45 cgroup --w-------   1 root   root   0 Apr 17 09:45 clear_refs -r--r--r--   1 root   root   0 Apr 17 09:45 cmdline -rw-r--r--   1 root   root   0 Apr 17 09:45 coredump_filter -r--r--r--   1 root   root   0 Apr 17 09:45 cpuset lrwxrwxrwx   1 root   root   0 Apr 17 09:45 cwd -&gt; / -r--------   1 root   root   0 Apr 17 09:45 environ lrwxrwxrwx   1 root   root   0 Apr 17 09:45 exe -&gt; /usr/local/apache2/bin/httpd dr-x------   2 root   root   0 Apr 17 09:45 fd dr-x------   2 root   root   0 Apr 17 09:45 fdinfo -r--------   1 root   root   0 Apr 17 09:45 io -rw-------   1 root   root   0 Apr 17 09:45 limits -rw-r--r--   1 root   root   0 Apr 17 09:45 loginuid -r--r--r--   1 root   root   0 Apr 17 09:45 maps -rw-------   1 root   root   0 Apr 17 09:45 mem -r--r--r--   1 root   root   0 Apr 17 09:45 mountinfo -r--r--r--   1 root   root   0 Apr 17 09:45 mounts -r--------   1 root   root   0 Apr 17 09:45 mountstats dr-xr-xr-x   6 apache apache 0 Apr 17 09:45 net -r--r--r--   1 root   root   0 Apr 17 09:45 numa_maps -rw-r--r--   1 root   root   0 Apr 17 09:45 oom_adj -r--r--r--   1 root   root   0 Apr 17 09:45 oom_score -rw-r--r--   1 root   root   0 Apr 17 09:45 oom_score_adj -r--r--r--   1 root   root   0 Apr 17 09:45 pagemap -r--r--r--   1 root   root   0 Apr 17 09:45 personality lrwxrwxrwx   1 root   root   0 Apr 17 09:45 root -&gt; / -rw-r--r--   1 root   root   0 Apr 17 09:45 sched -r--r--r--   1 root   root   0 Apr 17 09:45 schedstat -r--r--r--   1 root   root   0 Apr 17 09:45 sessionid -r--r--r--   1 root   root   0 Apr 17 09:45 smaps -r--r--r--   1 root   root   0 Apr 17 09:45 stack -r--r--r--   1 root   root   0 Apr 17 09:45 stat -r--r--r--   1 root   root   0 Apr 17 09:45 statm -r--r--r--   1 root   root   0 Apr 17 09:45 status -r--r--r--   1 root   root   0 Apr 17 09:45 syscall dr-xr-xr-x  29 apache apache 0 Apr 17 09:45 task -r--r--r--   1 root   root   0 Apr 17 09:45 wchan   Cound anyone tell me what it is?
43582
I can't seem to find an answer to this simple question, which I need for some compliance documentation.    On a default install of CentOS 6.5 (OpenSSH 5.3p1-94.el6), after how long of being idle will a user's SSH session be terminated?  I believe the following can be set to increase the idle timeout, but they are commented out by default.  $ grep -i alive /etc/ssh/sshd_config #TCPKeepAlive yes #ClientAliveInterval 0 #ClientAliveCountMax 3   Also, is there a command to dump a list of the current sshd settings?  I don't see anything in man sshd.
122504
I've been banging my head against for wall for a while with this one.  I want to SSH into a set of machines and check whether they are available (accepting connections and not being used). I have created a small script, tssh, which does just that:  #!/bin/bash  host=$1 timeout=${2:-1}  ssh -qo "ConnectTimeout $timeout" $host "[ \`who | cut -f1 | wc -l \` -eq 0 ] &amp;&amp; exit 0 || exit 1"   This script works correctly. Returning 255 if there was a connection problem, 1 if the machine is busy and 0 if everything is good. If anyone knows a better way to do this please let me know.  So next I try and call tssh on my set of machines using a while read loop, and this is where it all goes wrong. The loop exits as soon as tssh returns 0 and never completes the full set.   while read nu ; do tssh "MYBOXES$nu" ; done &lt; &lt;(ruby -e '(0..20).each { |i| puts i }')   At first I thought this was a subshell problem but apparently not. Any help, along with comments on style/content, would be much appreciated! I know I'm going to kick myself when I find out why...
20785
I don’t actually need to run the command below, and I am aware of ssh keys if I did want to log in without typing a password. I would just like to know how ssh seems to circumvent my file redirection.  Running the following command, ssh prompts me for a password:  ssh nobody@192.168.1.151 &gt; /dev/null 2&gt; /dev/null &lt; /dev/null   How does this work? stdin, stdout, and stderr are all redirected, but ssh still manages to print a prompt on my screen and read what I type. I tried adding the ssh arguments -t -t and -T (not both at once), to enable or disable pseudo-tty allocation, but it made no difference.  I also tried closing all input and output this way, although I don’t know if I typed it correctly. Still, ssh prompts for a password:  (exec 0&lt;&amp;- 1&lt;&amp;- 2&lt;&amp;- 0&gt;&amp;- 1&gt;&amp;- 2&gt;&amp;-; ssh nobody@192.168.1.151)
54764
I've been trying to configure sftp in a debian server.sshd_config:  Subsystem sftp internal-sftp  UsePAM no  Match User sftpUser ChrootDirectory /users/sftp/sftpUser ForceCommand internal-sftp AllowTcpForwarding no X11Forwarding no   Directories:   drwxr-xr-x   3 root      root      4096 Oct 20 10:59 users   drwxr-xr-x   3 root      root      4096 Oct 20 11:00 sftp   drwxr-xr-x   2 root      root      4096 Oct 20 11:00 sftpUser   cat /var/log/auth.log  Oct 20 10:58:22 w1 sshd[24634]: Accepted password for sftpUser from 201.156.103.213 port 34106 ssh2 Oct 20 10:58:22 w1 sshd[24636]: fatal: bad ownership or modes for chroot directory component "/"   sftpUser no home, bin/falseand member of user group.  In the client side I'm getting the famous Write failed: Broken pipe and then the connection is dropped.  Commenting the ChrootDirectorycommand in sshd_config makes the connection, but get's the user loose.  What am I doing wrong ?
46725
I'm using Ubuntu server 10.04.   ssh-add /foo/cert.pem gave the following output:     Could not open a connection to your   authentication agent.   These are my running processes:  ps -aux | grep ssh Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html root      1523  0.0  0.0  49260   632 ?        Ss   Dec25   0:00 /usr/sbin/sshd root     10023  0.0  0.3 141304  6012 ?        Ss   12:58   0:00 sshd: padmin [priv] padmin   10117  0.0  0.1 141304  2400 ?        S    12:58   0:00 sshd: padmin@pts/1 padmin   11867  0.0  0.0   7628   964 pts/1    S+   13:06   0:00 grep --color=auto ssh root     31041  0.0  0.3 141264  5884 ?        Ss   11:24   0:00 sshd: padmin [priv] padmin   31138  0.0  0.1 141264  2312 ?        S    11:25   0:00 sshd: padmin@pts/0 root     31382  0.0  0.3 139240  5844 ?        Ss   11:26   0:00 sshd: padmin [priv] padmin   31475  0.0  0.1 139372  2488 ?        S    11:27   0:00 sshd: padmin@notty padmin   31476  0.0  0.0  12468   964 ?        Ss   11:27   0:00 /usr/lib/openssh/sftp-server   These are my environment variables:  $ env | grep SSH SSH_CLIENT=192.168.1.13 42626 22 SSH_TTY=/dev/pts/1 SSH_CONNECTION=192.168.1.13 42626 192.168.1.2 22   What is wrong? Why can't I add any identities?
43320
I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong.  I'm using Linux Mint and I'm trying to figure out how scp works.  I've a file file.ext (on my computer) in directory /home/name/dir/  I connect to a remote machine using ssh, like:  ssh -p 2222 username@domain   it asks me the password and the shell displays:  username@domain ~ $   now, If I issue the command (before I ran ssh I was in the local directory  /home/name/dir ):  scp -r -P 2222 file.ext username@domain    output is:  cp: cannot stat ‘file.ext’: No such file or directory   Same result if instead of file.ext I write the complete path  scp -r -P 2222 /home/name/dir/file.ext username@domain    Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:  scp -r -P 2222 file.ext username@domain:~/   but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input.  Summary of my problems:    cp: no such file or directory shell "stuck" on ~/   Any suggestions?
116370
EDIT: I have since found that by using a folder in the root directory, things get a bit further - I can list the subfiles.  So it really looks like permissions on the folder are the issue.  I'm not sure what else to do besides chmod 777.  I'm trying to configure an anonymous rsync daemon on CentOS 5.9.  If I allow chroot the server reports that chroot fails.  If I disable it, chdir fails.  # rsyncd.conf  max connections = 20 log file = /var/log/rsync.log timeout = 300 use chroot = false  [builds]     path = /home/fuzz/builds     read only = yes     list = yes     uid = nobody     gid = nobody   .  # /etc/xinetd.d/rsync  # default: off # description: The rsync server is a good addition to an ftp server, as it \ #       allows crc checksumming etc. service rsync {         disable = no         socket_type     = stream         wait            = no         user            = root         server          = /usr/bin/rsync         server_args     = --daemon         log_on_failure  += USERID }   I have set all files and folders under /home/fuzz/builds to 777.  The folder is owned by the user fuzz.  On the client side, this works...  $ rsync rsync://host builds   But when I try to view the contents of the builds directory, I get this error...  $ rsync -vvvv rsync://host/builds opening tcp connection to host port 873 Connected to host (10.186.5.90) note: iconv_open("UTF-8", "UTF-8") succeeded. sending daemon args: --server --sender -vvvvde.Lsf . builds/ @ERROR: chdir failed [Receiver] _exit_cleanup(code=5, file=main.c, line=1534): entered rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9] [Receiver] _exit_cleanup(code=5, file=main.c, line=1534): about to call exit(5)
19208
I want to give a client access to my server, but I want to limit those users to their home directories. I will bind-mount in any files I want them to be able to see.  I've created a user called bob and added him to a new group called sftponly. They have a home directory at /home/bob. I've changed their shell to /bin/false to stop SSH logins. Here is their /etc/passwd line:  bob:x:1001:1002::/home/bob:/bin/false   I've also changed the /etc/ssh/sshd_config to include the following:  Match Group sftponly         ChrootDirectory /home/%u         ForceCommand internal-sftp         AllowTcpForwarding no   When I try to log in as them, here's what I see   $ sftp bob@server bob@server's password:  Write failed: Broken pipe Couldn't read packet: Connection reset by peer   If I comment out the ChrootDirectory line I can SFTP in but then they have free rein over the server. I have found that ChrootDirectory /home works, but it still gives them access to any home directory. I have explicitly tried ChrootDirectory /home/bob but that doesn't work either.  What am I doing wrong? How can I limit bob to /home/bob/?  ----EDIT-----  Okay so I just had a look at /var/log/auth.log and saw this:  May  9 14:45:48 nj sshd[5074]: pam_unix(sshd:session): session opened for user bob by (uid=0) May  9 14:45:48 nj sshd[5091]: fatal: bad ownership or modes for chroot directory component "/home/bob/" May  9 14:45:48 nj sshd[5074]: pam_unix(sshd:session): session closed for user bob   I'm not entirely sure what's going on there,  but it suggests something is wrong with the user directory. Here is the ls -h /home output:  drwxr-xr-x 26 oli      oli      4096 2012-01-19 17:19 oli drwxr-xr-x  3 bob      bob      4096 2012-05-09 14:11 bob
56386
Each time putty is closing the session after some time if it is idle.  There is no time parameter on putty, so how can I keep my putty ssh session always Alive?
100379
I'm using PuTTY (Windows 7) to send data using a Raw connection. I type in the data I want to send, but I have to press Return to actually have it transmit the data.  However, the problem is that the CR/LF is sent along with the data, which is invalid as far as the server application is concerned.   Is there a way of either having PuTTY not send the actual CR/LF as a result of pressing Return, or another way of sending the data that was just typed in?
12870
Which command / configuration file controls the open file limits on OS X?  Is there a different command for OS X 10.5 / 10.6 / 10.7?  The options I explore below are ulimit, sysctl, and launchctl  "Too many open files" is apparently a common error on Leopard, perhaps other versions of OS X:        There are many (related?) ways to view the open file limits:  $ ulimit -a core file size          (blocks, -c) 0 data seg size           (kbytes, -d) unlimited file size               (blocks, -f) unlimited max locked memory       (kbytes, -l) unlimited max memory size         (kbytes, -m) unlimited open files                      (-n) 2048 pipe size            (512 bytes, -p) 1 stack size              (kbytes, -s) 8192 cpu time               (seconds, -t) unlimited max user processes              (-u) 512 virtual memory          (kbytes, -v) unlimited   $ launchctl limit cpu         unlimited      unlimited       filesize    unlimited      unlimited       data        unlimited      unlimited       stack       8388608        67104768        core        0              unlimited       rss         unlimited      unlimited       memlock     unlimited      unlimited       maxproc     1024           2048            maxfiles    2048           4096         $ sysctl -a | grep files kern.maxfiles = 32768 kern.maxfilesperproc = 16384 kern.maxfiles: 32768 kern.maxfilesperproc: 16384 kern.num_files: 2049   It has been claimed in some of the above posts that these can be modified with the following commands:  sudo launchctl limit maxfiles 16384 32768 sudo ulimit -n 32768 sudo sysctl -w kern.maxfilesperproc=16384 sudo sysctl -w kern.maxfiles=32768   However, out of the above commands, only the sysctl commands have any apparently effect (i.e. ulimit -n and launchctl limit show no change after the above commands have been entered, while sysctl -a does show the requested changes).  The corresponding locations to change these parameters for the OS are:  /etc/sysctl.conf /etc/launchd.conf   I also discovered one  which reads that ulimit only controls the current shell.  How can I adjust upwards the max files / max open files limits on macOS?