Question

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.

  • 755 on every folder
  • 644 on the script and jarfile
  • home directory´s ownership is root:root
  • subfolders and files ownership owns the user which runs the scripts (user:user)

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top