Yahoo : Winternet : TC Guide  : Files of Local Interest Enter Sysinfo.com :

Subject: Re: Directory rights
Subject: Re: chmod a file directory
Subject: Re: How to do an ls on dot(.) files
Subject: Re: HELP I NEED A GURU!
Subject: Re: ls -Rd doesn't work!
Subject: Re: ls -Rd doesn't work!
Subject: ls -Rd doesn't work!
Subject: Re: ls -Rd doesn't work!
Subject: Re: Special Chars in Dirs.
Subject: Re: File permission question
Subject: Re: UNIX "Batch" File?
Subject: Re: Special Chars in Dirs.
Subject: Re: Special Chars in Dirs.



Newsgroups: comp.unix.questions
From: stern@phys.cwru.edu (Michael Sternberg)
Newsgroups: comp.unix.questions
Subject: Re: Directory rights
Date: 19 Jul 95 00:42:48 GMT
Lines: 29
Reply-To: stern@els3.phys.cwru.edu

strelnik@student.uci.agh.edu.pl (Stanislaw Strelnik) writes:
>   What practical (and theoretical) consequences have the following rights
>for a directory:
>  drwxr-sr-x ...
>  drwx--S--- ...
>  How is it done? I thought for every file you have only three bits for 
>you,group and others - and they are for read, write and execute rights.

Actually, you have 12 bits.  rwx for u,g,o plus "setuid", "setgid" and
"sticky".  For programs, the setuid and setgid bits change the
ownership and group-ownership, respectively, of the process that runs
the program to the owner and group of the file.  Best example:
passwd(1).  setuid and setgid have no implications on directories.
setugid are indicated by ls(1)  at the "x" positions as "s" or "S", if
the corresponding "x" permissions are granted or not, respectively.

The "sticky" bit is (for most unices) only of historic importance and
tells the kernel to leave the program text in swap memory even when the
last process that used it died - saves reload time.  For directories,
it indicates that only the owner of files can delete or rename files in
there.  ls(1) signals sticky as "t" or "T" in the "x" position of
"others".  /tmp is the canonical example.  Would be a pity if anyone
could remove any files from there.  See also chmod(2).


--
Michael Sternberg, Physics Research Scholar	mgs@po.cwru.edu
Case Western Reserve University		Lab phone: (216) 368 4034
"Who disturrrbs me at this time?"	<< Zaphod Beeblebrox IV >>

--

Newsgroups: comp.os.linux.setup
From: aa276@sfn.saskatoon.sk.ca (Mark Anthony Duguid)
Newsgroups: comp.os.linux.setup
Subject: Re: chmod a file directory
Date: 29 Jun 1995 20:41:57 GMT
Lines: 63

Sam Tindel (stindel@detour1.nerc.com) wrote:
:  Is there a way I can in my own home directory create a sub-directory
: that I could change the chmod permissions so only I can get into that
: directory and no one else can, and no one can even to read its
: contents?

man chmod

however i dont think that man page was written for people needing help
(it didnt tell me a hell of a lot)

chmod 0700 dir_u_wanna_hide_contents


in that 4 digit number, the second digit represents the permissions given 
to the owner of the file/directory, the third is the permissions given to 
members of the group ownership, and the 4th is everyone else.


1 stands for execute permissions (only execute the binary, or change into 
  the directory
2 stands for write permissions.  if its a directory, then it allows the 
  person to add and delete files in the directory.
4 stands for read permissions, as in reading the contents of a file or 
  getting a directory listing.

add up the numbers you want to give permissions for.

eg, to execute into a directory, (1), and not be able to see what the 
files are in the directory, yet allow others to add files into it (2)
you would give mode 703


give yourself a 7 cuz u dont want to lock yourself out of your own dir.

the first number does different things for files and directories.

for dirs
 1  means that people cant delete files that dont belong to them, even if 
    they have write permissions for that directory.

for files
 1  i *think*, means the the program wont get swapped out when executed
    (requires the program to be owned by root)
 2  is a set group id bit.  means that the program, upon execution gains 
    the permissions of the group that owns the file. eg: you arent in 
    group foobar, and only group foobar can write in the /foobar directory, 
    but this special program is setgid, and through the program, u can dump 
    files into the /foobar as if u had group foobar permissions.
 4  is the setuid bit.  same as above, but give the permisions of the 
    owner of the executable. eg:, lets say sh is mode 4755 (setuid 
    bit set), if u where to run it, u would be able to do anything the owner 
    of the file could do.


whew!...any questions?


Mark Duguid      Certified Linux Geek        Saskatoon, Saskatchewan, Canada
aa276@sfn.saskatoon.sk.ca       Web -> http://www.sfn.saskatoon.sk.ca/~aa276
"To turn any 486/586 into a 8088,..just add Dos and let freeze over Windows.
"MS-Windows and Win95 are the only viruses with a GUI." nuf bashin for today


--

Newsgroups: comp.unix.questions
From: will@Starbase.NeoSoft.COM (Will Morse)
Newsgroups: comp.unix.questions
Subject: Re: How to do an ls on dot(.) files
Date: 25 Jul 1995 13:38:56 -0500
Lines: 96

In article <3v3a7h$pau@cliffy.lfwc.lockheed.com>,
Tad McClellan <tad@harrier> wrote:
>Dirk Everling/ktz vdg (everling@iis.fhg.de) wrote:
>
>: ls -a will list all files, whether hidden or not.
>
>: To list only the hidden ones, use
>
>: ls -d .??*
>
>of course if you have a file named '.a' you'll miss it this way.
>
>I use: ls -a |grep '^\.'
>
>--

I think it is useful to explain a little about how the ls command works
with the shell.

If you type ls by itself, or with switches only, no file names, the ls
command reads the current directory and lists the files.  Using ls -a
will list the hidden files (.xx files).

If you type ls and any number of filenames, without wildcards, ls will
only report on the listed filenames.  

      $ ls a.dat b.dat .profile
      a.dat
      b.dat
      .profile

If you use a wildcard, the SHELL interprets the wildcard before passing
the parameters to ls so that, in a directory containing a.dat and b.dat,
but no other .dat files:

      $ ls *.dat

is the same as typing 

     $ ls a.dat b.dat

This leads to the purhaps surprising result that

     $ ls -a *

will not list the hidden files, because the SHELL will not match them
in the *, so in our example above

     $ls -a *

is the same as typing

    $ ls -a a.dat b.dat

On other item, when ls has a directory as its parameter, it lists the
contents of the directory, rather than the directory itself, unless
you use the -d flag.   Where this is a problem is that . and .. are
directories (technically, hard links to directories) so that 

    $ ls .*

is going to print out the current directory (.), and the parent directory
(..) as well as any matches of hidden files.

    $ ls -d .[!.]*

will not travel the directories (-d) and will match files that start with
. and have anything but . ([!.]) as there second character, followed by
zero or more other characters.  This will exclude both . and .. in the
pattern expanded by the SHELL, and ls will print only the hidden files
AND hidden directories.

Printing only hidden files (e.g., excluding hidden directories, special 
devices, links, etc) gets a little tougher.  At this point you need 
something to figure out if the file is a file or a directory.  In an 
ls -l listing, plain files have a - as the first character of the permission
field, so you could do

    $ ls -d `ls -dl .[!.]* | grep '^-' | awk '{print $8}'`

and of course, there are several ways to code this.

The main point is that you need to understand not only the ls command,
but also what the shell is doing before it executes the command line.

Hope this helps.

Will
      
-- 
#      Gravity,                    #    Will Morse
#      not just a good idea,       #    BHP Petroleum (Americas) Inc.
#              it's the law.       #    Houston, Texas 
#                                  #    will@starbase.neosoft.com
#
#   These are my views and do not necessarly reflect the views of BHP !

--

Newsgroups: comp.unix.admin
From: jpm@dtc.kodak.com (Jeff Miller)
Newsgroups: comp.unix.admin
Subject: Re: HELP I NEED A GURU!
Date: 28 Sep 1995 20:06:04 GMT
Lines: 28
Distribution: world
Reply-To: jpm@dtc.kodak.com
Keywords: umask

>I believe you both missed the point of the original post.  
>It sounded to me like the poster wanted to make a directory 
>where the default file/directory access was 666 at creation 
>regardless of the users umask.  He did not want to have to
>keep doing 'chmod -R 666'.  I don't know of any way to do this 
>and would be very interested to hear if anyone does.  I think
>the best that can be done is a daemon or cron script that does
>the chmod every few minutes/seconds.

You can use the umask command to set the default mode for newly 
created files.  If you want all files to be created 666, then
subtract 666 from 777 and get 111 for the umask value.   `

Another example:
If you want to create all files w/ umask value of 751, then subtract 
751 from 777 to get umask value of 026.

Set the umask in .cshrc file as follows: umask 026

Hope this did not already get covered.

Jeff


 




--

Newsgroups: comp.unix.admin, comp.unix.misc, comp.sys.sun.admin,
    comp.unix.shell, comp.unix.admin
From: ats@hubert.hubert.wustl.edu (Alan Shutko)
Newsgroups: comp.unix.admin,comp.unix.misc,
comp.sys.sun.admin,comp.unix.shell,comp.unix.admin
Subject: Re: ls -Rd doesn't work!
Date: 03 Feb 1996 17:25:47 -0600
Lines: 14
In-reply-to: ejo@pha.jhu.edu's message of 3 Feb 1996 19:57:37 GMT
To: ejo@pha.jhu.edu

>>>>> "EJO" == Eric J Ostrander <ejo@pha.jhu.edu> writes:

EJO> Dear comp.unix.shell readers, I have need to ls the names of
EJO> directories in a tree.  `ls -R` lists recusively `ls -d` lists
EJO> just the directory's name However, when I type `ls -dR` the "R"
EJO> ceases to function

Yes.  The -d option specifically prevents it from showing the contents
of directories.

EJO>   Is there a command that will recursively list a directory tree,
EJO> listing only the directory names?

find . -type d -print

--

Newsgroups: comp.unix.admin, comp.unix.shell
From: khockenb@attila.stevens-tech.edu (Kurt Hockenbury)
Newsgroups: comp.unix.admin,comp.unix.misc,
comp.sys.sun.admin,comp.unix.shell
Subject: Re: ls -Rd doesn't work!
Followup-To: comp.unix.admin,
comp.unix.shell
Date: 4 Feb 1996 07:12:02 GMT
Lines: 25

Alan Shutko (ats@hubert.hubert.wustl.edu) wrote:
: >>>>> "EJO" == Eric J Ostrander <ejo@pha.jhu.edu> writes:

: EJO>   Is there a command that will recursively list a directory tree,
: EJO> listing only the directory names?

: find . -type d -print

Yup.  Though if you want to get a bit fancier :-)

$ cat tree
#!/bin/sh
(cd $1; pwd)
find $1 -type d -print | sort -f |
sed -e "s, ^$1,," -e "/^$/d" -e \
"s,[^/]*/\([^/]*\)$,\'-----\1," -e "s,[^/]*/,|     ,g"

This (or a close ancestor thereof) I got off the net several years ago,
but I don't recall who wrote it.

	-Kurt
-- 
                                                                      [Place]
snail://USA/07030/NJ/Hoboken/PO Box 5136/Kurt M. Hockenbury           [Stamp]
                                                                      [Here.]

--

Newsgroups: comp.unix.admin, comp.unix.misc, 
comp.sys.sun.admin,
    comp.unix.shell, 
comp.unix.admin
From: ejo@pha.jhu.edu (Eric J. Ostrander)
Newsgroups: comp.unix.admin,comp.unix.misc,comp.sys.sun.admin,
comp.unix.shell,comp.unix.admin
Subject: ls -Rd doesn't work!
Date: 3 Feb 1996 19:57:37 GMT
Lines: 24
Reply-To: ejo@pha.jhu.edu

Dear comp.unix.shell readers,

I have need to ls the names of directories in a tree.
  `ls -R`   lists recusively
  `ls -d`   lists just the directory's name
However, when I type
  `ls -dR`  the "R" ceases to function

  `du`  is nice, but doesn't follow symbolic links

   This is ok too, but seems a bit convoluted for the purpose.
   `ls -aR directory | nawk '{if(match($1,":")!=0) print$0}'`

  Is there a command that will recursively list a directory tree,
listing only the directory names?

                         Thanks,

                           Eric J. Ostrander
                           ejo@mds.pha.jhu.edu
                           JOHNS HOPKINS UNIVERSITY
                           PHYSICS AND ASTRONOMY
                           


--

Newsgroups: comp.unix.admin, comp.unix.misc, comp.sys.sun.admin,
    comp.unix.shell, comp.unix.admin
Newsgroups: comp.unix.admin,
comp.unix.misc,comp.sys.sun.admin,
comp.unix.shell,
comp.unix.admin
From: szh@zcon.com (Syed Zaeem Hosain)
Subject: Re: ls -Rd doesn't work!
Nntp-Posting-Host: zodiac
Reply-To: szh@zcon.com
Date: Sun, 4 Feb 1996 20:33:55 GMT
Lines: 31

In article <4f0enh$bjj@news.jhu.edu>, ejo@pha.jhu.edu (Eric J. Ostrander) writes:
>Dear comp.unix.shell readers,
>
>I have need to ls the names of directories in a tree.
>  `ls -R`   lists recusively
>  `ls -d`   lists just the directory's name
>However, when I type
>  `ls -dR`  the "R" ceases to function
>
>  `du`  is nice, but doesn't follow symbolic links
>
>   This is ok too, but seems a bit convoluted for the purpose.
>   `ls -aR directory | nawk '{if(match($1,":")!=0) print$0}'`
>
>  Is there a command that will recursively list a directory tree,
>listing only the directory names?

This works on my Sun system, and I assume that other Unix systems will
be similar:

	find . -type d -print

								Z



-- 
-------------------------------------------------------------------------
| Syed Zaeem Hosain          P. O. Box 610097            (408) 441-7021 |
| Z Consulting Group        San Jose, CA 95161             szh@zcon.com |
-------------------------------------------------------------------------

--

Newsgroups: alt.unix.wizards
From: bmarcum@iglou2.iglou.com (Bill Marcum)
Subject: Re: Special Chars in Dirs.
Date: Tue, 27 Feb 1996 20:23:08 GMT
Lines: 18

In article <4gvk6t$mlm@News.Dal.Ca>,
Darren Keith McKeigan <mckeigdk@newton.ccs.tuns.ca> wrote:
>Hi, how does one get into a directory (or remove) with a special CTRL char
>in it?  I think the one in question is code \377.
>
cd `echo '\377'`
If you aren't sure what the control character is, but it's part of the 
directory name, you could use wildcard characters, like
ls name*
or
ls *name
When you find a wildcard expression that lists only the desired 
directory, you can 'cd' or 'mv' or 'rm -r' it.

-- 
'Family values is a code phrase meaning "supression of minority
lifestyles" just as, say, "law and order" means "pro racial
discrimination".'

--

From: Peter Jerde <jerde@winternet.com>
Newsgroups: winternet.help.unix
Subject: Re: File permission question
Date: 6 Jan 1996 22:04:57 GMT
Lines: 20
Distribution: local
Mime-Version: 1.0

Karl Erickson, kae@winternet.com writes:
>Now, if one were to *remove* the write/execute permission for the group
>(while leaving the "other" permissions the same), would the incoming
>directory function without this "hazardous" :) loophole?

Ahh... you got smart rabbits workin' for ya. chmod 703... has a nice ring
to it, don't it?

I'm not used to group permissions being respected that way... Macs don't
do that.

Thanks for the suggestion... 

It makes sense, it works, and <blush> gosh yes.

But _still_ I should be able to remove ANYTHING that's in MY directory, no?

(Is man not god of his own directories?)

 - Peter

--


From: bmiller@convex.com (Bruce Miller)
Newsgroups: alt.unix.wizards
Subject: Re: UNIX "Batch" File?
Date: 27 Feb 1996 20:59:13 GMT
Lines: 34

James Redding (cracked@primenet.com) wrote:
: I'd like to make a "batch" file for UNIX (maybe they are called scripts?) 
: called 'dir' which will execute a 'ls -a -D -l |more'.  How can I make 
: such a file to do this?

It will really depend on which shell you are using. I would probably use an
alias in csh, i.e.:     alias dir 'ls -laD \!* | more'
This allows you to do a 'dir <path>'

In Bourne shell and ksh I would probably use a function, but a script would 
work also: 
% cat > dir
#!/bin/sh
ls -la $@ | more

% chmod +x dir

Regards,
Bruce Miller

:    _  ____________.--------.
:    \`'  __________|________|
:    /   [__)__]
:   |    |
:  .'   .'  E-Mail: cracked@primenet.com
:  |____|   Home Page: http://www.primenet.com/~cracked

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bruce Miller		|			on loan to:
Paranet, Inc.		|			HP Convex Technology Center
(214) 239-5544		|			(214) 497-4774
(214) 239-2109 fax	|
bjmiller@paranet.com	|			bmiller@flare.convex.com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--


Newsgroups: alt.unix.wizards
From: bmarcum@iglou2.iglou.com (Bill Marcum)
Subject: Re: Special Chars in Dirs.
Date: Tue, 27 Feb 1996 20:23:08 GMT
Lines: 18

In article <4gvk6t$mlm@News.Dal.Ca>,
Darren Keith McKeigan <mckeigdk@newton.ccs.tuns.ca> wrote:
>Hi, how does one get into a directory (or remove) with a special CTRL char
>in it?  I think the one in question is code \377.
>
cd `echo '\377'`
If you aren't sure what the control character is, but it's part of the 
directory name, you could use wildcard characters, like
ls name*
or
ls *name
When you find a wildcard expression that lists only the desired 
directory, you can 'cd' or 'mv' or 'rm -r' it.

-- 
'Family values is a code phrase meaning "supression of minority
lifestyles" just as, say, "law and order" means "pro racial
discrimination".'

--


From: richk@panix.com (Rich Kus)
Newsgroups: alt.unix.wizards
Subject: Re: Special Chars in Dirs.
Date: 28 Feb 1996 09:26:42 -0500
Lines: 29

In article <4gvk6t$mlm@News.Dal.Ca>,
Darren Keith McKeigan <mckeigdk@newton.ccs.tuns.ca> wrote:
>Hi, how does one get into a directory (or remove) with a special CTRL char
>in it?  I think the one in question is code \377.
>

doing l -b will show the unprintable charater.
doing l -q will show the unprintable charater as a ?.

 for example if i have a filename  he^ALLO .
 ls 
 heLLO
 ls -b
 he\001LLO
 ls -q
 he?LLO

 to change the filename

 mv he?LLO heLLO
 ls -b
 heLLO

 or mv he\001LLO heLLO

 this works for rm.

 richk


--

Yahoo : Winternet : TC Guide  : Files of Local Interest Enter Sysinfo.com :



Hosted by: Enter:  sysinfo.com


©copyright 1995-2002 sysinfo.com