1

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.

4
  • You misspelled "directory" in the error message you showed us. Did you spell it correctly in your actual script? "home directorys ownership is root:roo" Do you mean "/home directory"? Do you mean "root:root"? There are so many typos in your question, it's nearly impossible to tell what the problem is. Please show us (a small version of) the actual script, along with the actual error message. Copy-and-paste as much information as possible; don't re-type it. Commented Sep 2, 2013 at 18:40
  • updated it. I hope it is now understandable Commented Sep 2, 2013 at 19:02
  • 1
    If the copy/paste of the error messages is faithful, looks like DOS carriage returns in your script file. Examine it with a hex dump tool, or simply see if dos2unix will fix it. Commented Sep 2, 2013 at 19:15
  • dos2unix helped, Thanks. How can something like this happen ? I just downloaded and uploaded it with winscp. I didn´t even open it. Commented Sep 2, 2013 at 19:31

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Do you know where to change this ? Dont find it.
@user2693017 Don't you get the login screen when you start WinSCP? It's the top option under "Environment" there. The transfer settings dialog is under "Options/Preferences/Transfer/Default transfer settings" in the actual program's menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.