Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
I wrote a shell script. I do it on Putty and execute it and it just sit there. I cant exit and Control - C doesnt work either. I have ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    8

    I cant execute a shell script while on SSH client

    I wrote a shell script.

    I do it on Putty and execute it and it just sit there. I cant exit and Control - C doesnt work either. I have to kill my Putty.

    However, when I run this *same* file physically on the machine without SSH in, it work and can execute.

    Is there something wrong with my SSH setup?

    How do I execute a .sh script on Putty or any SSH client software remotely.

  2. #2
    Just Joined!
    Join Date
    Apr 2009
    Posts
    8
    I answered by own question.

    When I am in Putty, I use "sudo su" .. then I am able to execute the .sh script

    When I am not a "su", I cant execute the script. Why?

    I wrote that script without using "sudo".

    ===================================

    When I am physically on the machine, I can run that script without doing "sudo su". Why?

    ===================================

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    This should not be an issue if you can log in and execute normal system commands, such as 'ls', 'pwd', etc. What shell are you using?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Quote Originally Posted by chong67 View Post
    I answered by own question.

    When I am in Putty, I use "sudo su" .. then I am able to execute the .sh script

    When I am not a "su", I cant execute the script. Why?

    I wrote that script without using "sudo".

    ===================================

    When I am physically on the machine, I can run that script without doing "sudo su". Why?

    ===================================
    Ok. It's not an ssh problem. It is probably a permissions problem. What does "ls -l scriptname" show you?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Apr 2009
    Posts
    8
    You see I was not using superaccess to write my script, just a normal user name "philip" and I cant even do a "./ginfo" on it unless I do "sudo su" while in Putty. Physically on the machine, it will execute without doing "sudo su".

    Please explain.

    Thanks!

    ---
    I am using the Bash shell.

    $ ls -l
    -rwxr-xr-x 1 philip philip 207 2009-04-27 11:58 ginfo


    Below is my shell script and filename is "ginfo"
    ===================================
    #
    # Script to print user information who currently login , current date & time
    #
    clear
    echo "Hello $USER"
    echo "Today is \c ";date
    echo "Number of user login : \c" ; who | wc -l
    echo "Calendar"
    cal
    exit 0
    ===================================

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Ok. My guess is that your ssh privileges are not allowing you to execute shell scripts for some reason. That's the only other thing I can think of, though I cannot find anything in ssh_config or sshd_config that would exclude script execution. Have you tried an ssh client other than putty, like the normal ssh client? If you are running a Windows client, then you can install cygwin and it has an ssh client you can use.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Just Joined!
    Join Date
    Apr 2009
    Posts
    8
    I got cygwin installed but didnt like one bit about it.

    Maybe I will try with secureCRT.

    Looking for more clues if anyone has it.

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    What's not to like? It is just a Linux/Unix bash shell environment for Windoze. There are a number of irritations, for sure, but it works reliably and provides all the gnu tools you might want. I find I much prefer it when I want a functional command line in Windows in favor of cmd.exe, which is totally brain-dead, IMHO. Yes, I know there are better shells for Windows now, but they are still a pain in the arse.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    Apr 2009
    Posts
    8
    For one thing, I cant resize Cgywin. It is so hard to use. Have you use FreeNX? This software is so cool on my Linux Desktop. I feel like I am in front of my computer even in remote.

    I try to do Cgywin on my Linux server and I failed.

    I am still try to figure out my post #1. Why doesnt it work?

  10. #10
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Quote Originally Posted by chong67 View Post
    For one thing, I cant resize Cgywin. It is so hard to use. Have you use FreeNX? This software is so cool on my Linux Desktop. I feel like I am in front of my computer even in remote.

    I try to do Cgywin on my Linux server and I failed.

    I am still try to figure out my post #1. Why doesnt it work?
    I've never had any problems resizing the cygwin window. You can also set the window to always open at the selected size when you want. You do it by right-clicking on the title bar of the window and select Properties->Layout and change the size, scroll-back buffer, etc. I only use cygwin on Windows.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...