user2693017
user2693017

Reputation: 1870

Can't cd via ssh script - Debian

I have one Debian 6 Server where it doenst work to run a cd commond through a ssh script. It allways throws the error "cd: can´t cd to /home/user/directory/ \ Error: Unable to access jarfile name.jar"

I douple checked the permissions. They look all fine.

The thing I dont understand is, that it works on my other three servers just fine and the setup is the same.


#!/bin/bash

cd /home/mcgameserver/unhinged/
java -Xmx30M -Xms30M -XX:MaxPermSize=40M -jar Minecraft_RKit.jar

this also doesnt work:

DIRECTORY=$(cd "`dirname "$0"`" && pwd)
(cd "$DIRECTORY"; java -Xmx30M -Xms30M -XX:MaxPermSize=40M -jar Minecraft_RKit.jar ${USER}:${PASS})

Permissions:

Path: /home/mcgameserver/unhinged/

drwxr-xr-x   4 root root  4096 Sep  2 03:18 home
drwxr-xr-x 7 mcgameserver mcgameserver 4096 Sep  2 02:45 mcgameserver
drwxr-xr-x 11 mcgameserver mcgameserver 4096 Sep  2 01:56 unhinged
-rw-r--r--  1 mcgameserver mcgameserver      342 Sep  2 20:07 rtoolkit.sh
-rw-r--r--  1 mcgameserver mcgameserver   555336 Sep  2 01:08 Minecraft_RKit.jar

Error first script:

mcgameserver@3770-41:~$ sh /home/mcgameserver/unhinged/rtoolkit.sh
: not foundeserver/unhinged/rtoolkit.sh: 2: /home/mcgameserver/unhinged/rtoolkit.sh:
: not foundeserver/unhinged/rtoolkit.sh: 5: /home/mcgameserver/unhinged/rtoolkit.sh:
/home/mcgameserver/unhinged/rtoolkit.sh: 9: cd: can't cd to /home/mcgameserver/unhinged/
Error: Unable to access jarfile Minecraft_RKit.jar

Error second script:

mcgameserver@3770-41:~$ sh /home/mcgameserver/unhinged/rtoolkit.sh
: not foundeserver/unhinged/rtoolkit.sh: 2: /home/mcgameserver/unhinged/rtoolkit.sh:
: not foundeserver/unhinged/rtoolkit.sh: 5: /home/mcgameserver/unhinged/rtoolkit.sh:
/home/mcgameserver/unhinged/rtoolkit.sh: 8: /home/mcgameserver/unhinged/rtoolkit.sh: Syntax error: word unexpected

The same script is running on 3 other servers. They are all installed the same way by me.

Upvotes: 1

Views: 987

Answers (1)

Adrian Frühwirth
Adrian Frühwirth

Reputation: 45706

If WinSCP is in text or auto transfer mode the End-of-line characters setting in the Environment dialog might have kicked in, possibly altering your linebreaks.

Upvotes: 1

Related Questions