LinuxQuestions.org
Visit Jeremy's Blog.
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 01-08-2011, 01:07 PM   #1
CrazyCrisUk
LQ Newbie
 
Registered: Jan 2011
Posts: 4

Rep: Reputation: 0
SFTP Memory Error (Insuficent)


Hi everybody!!

I have been setting up a vps I got out with bhost.net, with CentOS installed. I've been learning and have set up everying I need with the exception of ftp/sftp.

Using yum I installed vsftpd and ran into problems, thinking it was something I might of done I did a fresh install of CentOS and I still recieve the same problem on a fresh install so it is nothing I have done to the server.

The problem is when connecting via a sftp client I get an out of memory error. This error is listed in the putty faq ( http://www.chiark.greenend.org.uk/~s...#faq-outofmem2 ) under A.7.5, there is a brief explaintion of the cure under A.7.6.

The problem is I don't understand how to solve it, there is mention of a login script but I don't know where this is located. I'm a novice at Linux but by no means incompotent when it comes to computing.

If anyone can help I'll be so greatful. Thanks in advance!!!
 
Old 01-08-2011, 03:30 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,256

Rep: Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552
To my mind, sftp connects to sshd, not vsftpd.
The thing about vsftpd is it tries to make an insecure protocol (ftp) secure. I tried it once. sftp uses a superior protocol (ssh). Vsftpd sure was secure - so secure I couldn't get to download anything and gave up on it.
 
1 members found this post helpful.
Old 01-10-2011, 01:58 AM   #3
CrazyCrisUk
LQ Newbie
 
Registered: Jan 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Smile

Thanks very much, your right and with that knowledge I've been able to investigate this further.

The error is caused by a login script (used by ssh) displayed a commanded that is intended for being seen by humans (maybe echo something??). It trys to read this as being file size (I think) which cause the error.

Having converted the file size I get in the error message into hex, then into ascII I can tell that it starts with [roo . This would obviously be the [root]@vps or something similar.

I believe this must be made by an echo command trying to tell the server to display this. I don't know too much about login scripts but I looked through them and found a couple that mention echo. I will post the contents so hopefully we can figure this out. Thanks
 
Old 01-10-2011, 02:11 AM   #4
CrazyCrisUk
LQ Newbie
 
Registered: Jan 2011
Posts: 4

Original Poster
Rep: Reputation: 0
I think the problem may lay within this file???

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
EUID=`id -u`
UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi


export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done

unset i
unset pathmunge

Last edited by CrazyCrisUk; 01-10-2011 at 02:12 AM. Reason: Disable Simleys
 
Old 01-10-2011, 03:11 AM   #5
CrazyCrisUk
LQ Newbie
 
Registered: Jan 2011
Posts: 4

Original Poster
Rep: Reputation: 0
On closer inspection I'm more than certain that the answer lays here, there are comments at the bottom about changing echo commands.

I don't understand the code/language being used, I know only html/css so the answer could well be staring me in the face but I wouldn't be able to see it. :/

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# By default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"
; echo -ne "\007"'
fi

;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}";
echo -ne "\033\\"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfi
g/bash-prompt-default
;;
esac
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi

if ! shopt -q login_shell ; then # We're not a login shell
# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# Only display echos from profile.d scripts if we are no login shell
# and interactive - otherwise just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done

unset i
unset pathmunge
fi
# vim:ts=4:sw=4
 
Old 01-11-2011, 04:41 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,256

Rep: Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552
They are login files for bash. Try /etc/profile.d for anything relating to ssh, otherwise leave them.
On the ssh server, Try
/usr/bin/sshd
and then
ssh 127.0.0.1

What happens?
 
  


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
Error while saving memory pages of a process- Sleeping in memory from invalid context Deep Narayan Dubey Linux - Kernel 1 04-05-2012 03:58 PM
getting error while doing sftp linuxquery01 Linux - General 2 07-23-2009 12:04 PM
getting error while doing sftp linuxquery01 Linux - Desktop 1 07-23-2009 05:27 AM
sftp over a persistent connection (days/weeks) develops a memory leak da_kidd_er Linux - Software 1 12-22-2004 07:56 PM
sftp script error JeRrYmAn Linux - Networking 1 11-27-2003 08:21 PM

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

All times are GMT -5. The time now is 12:46 AM.

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