Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, Probably something simple I am missing but basically why will nano read the file and a small cat script (rme) not? Script at bottom. Copied rme to root. Changed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    4

    Permission Please to Read?


    Hello,
    Probably something simple I am missing but basically why will nano read the file and a small cat script (rme) not? Script at bottom.

    Copied rme to root. Changed own and group of rme. At no time would it read ufw.log. Why does nano read it and rme does not?

    -rwxr-xr-x 1 root root 51856 Jan 26 2013 /bin/cat
    -rwxr-xr-x 1 root root 192504 Jun 22 2012 /bin/nano
    -rwxr-xr-x 1 root root 41 Apr 29 09:45 rme
    -rw-r----- 1 root root 5583 Apr 29 09:22 ufw.log
    -----------------------------------------------------
    #!/bin/sh
    #rme
    cat /home/coot/Desktop/ufw.log

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    -rw-r----- 1 root root 5583 Apr 29 09:22 ufw.log
    I expect it is because the owner:group for that file is root:root and you are running it as a normal user. A normal user is not root and not a member of the group root. Changing the permissions on ufw.log to 644 would give 'others' read permission. I created a ufw.log text file on my Deskktop and entered a single line before changing permissions and got no output. After changing permissions, I could read it with cat.

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    4
    Thank you for the reply. What I was wondering about is 'nano'. Why is it able to read the file and my cat script not? Everything that I see is equal? As a user not root I can run nano on the file and it will pull it up. As a user the 'rme' cat script will not?

  4. #4
    Just Joined!
    Join Date
    Apr 2013
    Posts
    69
    Hi

    If you change

    Quote Originally Posted by Zedo View Post
    #!/bin/sh
    for

    Code:
    #!/bin/bash
    OR

    Quote Originally Posted by Zedo View Post
    cat /home/coot/Desktop/ufw.log
    for

    Code:
    -c "cat /home/coot/Desktop/ufw.log"
    ??

    I think that you got this issue because sh does not seems to "guess" what to do or where to do it. See the stdin section of this link for more informations.


    Bash can run most sh scripts without modification. -- tldp

Posting Permissions

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