Re: anyone uses fsck_y_enable=YES ?

2003-07-14 Thread Steve Coile
On Mon, 14 Jul 2003, Andrea Venturoli wrote:
[...]
 Do you guys use this option ? 

Yes.

Has anyone run into a situation where you'd answer no to an fsck
question?  In what circumstances would you not answer yes?

I can't remember ever answering no to fsck: if you do, you'll still
have an unstable filesystem and won't be able to use it safely.  If you
answer yes, the contents may be wrong, but the filesystem itself will
be stable and usable.

Thoughts?

-- 
Steve Coile
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Attn: sed(1) regular expression gurus

2003-07-15 Thread Steve Coile
On Mon, 14 Jul 2003, D J Hawkey Jr wrote:
I'm getting really frustrated by a seemingly simple problem. I'm doing
this under FreeBSD 4.5.

Given these portions of an e-mail's multi-line Received header as tests:

  by some.host.at.a.com (Postfix) with ESMTP id 3A4E07B03
  by some.host.at.a.com (8.11.6) ESMTP;
  by some.host.at.a.different.com (8.11.6p2/8.11.6) ESMTP;
  by some.host.at.another.com ([123.4.56.789]) id 3A4E07B03
  by some.host.at.yet.another.com (123.4.56.789) id 3A4E07B03

# tested with sed-4.0.5-1 for RHL 9.0

# remove junk we don't care about
s/^.*by \([^ ]*\) (\([^)]*\)).*$/\1 \2/
 
# identify valid hostname
s/^[[:alnum:]][-[:alnum:]]*\(\.[[:alnum:]][-[:alnum:]]*\)*/host:/
 
# identify valid IP address (w/o brackets)
s/[[:digit:]]\{1,3\}\(\.[[:digit:]]\{1,3\}*\)\{3\}$/ipaddr:/
 
# identify valid IP address (w/brackets)
s/\[\([[:digit:]]\{1,3\}\(\.[[:digit:]]\{1,3\}*\)\{3\}\)\]$/ipaddr:\1/
 
# discard if no valid hostname or IP address
/\(^host:\| ipaddr:\)/!d
 
# if valid IP address, discard anything else
s/^.* ipaddr://
 
# if valid hostname, discard anything else
s/^host:\([^ ]*\).*$/\1/

-- 
Steve Coile
Systems Administrator
Nando Media
ph: 919-861-1200
fax: 919-861-1300
e-mail: [EMAIL PROTECTED]
http://www.nandomedia.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: shell scripting while if string length != 0

2003-08-01 Thread Steve Coile
Dave:

From your description of the script, and from the script itself,
it appears that the reason you're checking for a blank command is to
determine when you've reached the end of commands.  Presumably, that
would only occur at the end of the file.  Is my interpretation correct?

If the reason you're looking for that blank line is to find the end of
commands, you could approach the problem this way:

- move the original file containing commands into a temporary file;
- create an empty file in the original location;
- execute the commands from the temporary file;
- delete the temporary file.

In this way, you avoid having the file of commands updated while you're
reading through it and executing commands.  You also avoid a number
of potential programatic pitfalls that are present with your current
approach, pitfalls that may result in the loss of changes to the file
containing commands.

So:

#/bin/sh

CMDFILE=/path/to/file_o_commands

# move current file to temporary location
mv -f ${CMDFILE} ${CMDFILE}.tmp

# create an empty command file
touch ${CMDFILE}

# commands are coming from the temporary file
eval  ${CMDFILE}.tmp

# read each command
while read command
do
# execute each command via SSH
eval ssh ${command}
done

# delete the temporary file
rm -f ${CMDFILE}.tmp

Note the use of eval.  It's necessary because the example you included
in your original posting included commands that include shell special
characters, such as the pipe (|).  Without the eval command, those
characters would not be treated the way you appear to want them treated
(as special characters).

-- 
Steve Coile
Systems Administrator
Nando Media
ph: 919-861-1200
fax: 919-861-1300
e-mail: [EMAIL PROTECTED]
http://www.nandomedia.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: converting %20 to a space in directory names

2003-08-14 Thread Steve Coile
On Sat, 9 Aug 2003, Vincent Zee wrote:
I have 5000 directory names with %20 in its names and would like to
replace them with 1 space.
I only want to change the directory names and leave its contents
untouched. Also I need to do this recursively (directories in
directories).
I checked google but the answers I found were for files in directories.

Completely untested.  Use at your own risk.

Replace TOPDIR with the name of the top of the directory tree.

find TOPDIR -depth -type d -name '*%20*' -print \
| while read old
do
new=`echo \${old}\ | sed -e 's/%20/ /g'`
( set -x; mv ${old} ${new} )
done

-- 
Steve Coile
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: passwd

2003-06-06 Thread Steve Coile
On Fri, 6 Jun 2003, Mark Redding wrote:
 #snip#
 
 passwd needs to run setuid root, so it can write the
 new password to
 /etc/master.passwd:
 
 [homer: danielby: ~]$ ls -l `which passwd`
 -r-sr-xr-x  2 root  wheel  32824 19 May 11:04
 /usr/bin/passwd*
 
 You need to re-enable the setuid bit.
 
 #end-snip#
 
 That's not it I'm afraid. The setuid bit was set
 anyway, and anyway, users who are members of the wheel
 group can execute the passwd command without trouble
 (I've only switched off 'other' access).

Many programs load shared libraries or invoke additional executables.
By disabling access to everything else, you prevent the use of these
additional files.

My recommendation is that you restore the permissions on everything and
find another way to do what you're trying to do.  Consider using the
restricted mode of existing command shells (e.g. bash -r).

You didn't change permissions on any directories, did you?  If so,
at least restore execute access for all users on those directories
you changed.  This will allow executables to use specific files within
those directories.

To determine what other files a program needs, you'll need to see what
dynamic libraries it's trying to load:

ldd `which passwd`

Make sure all of the files referenced are executable by all users.

Some programs (perhaps passwd) actually invoke other executables.
To find these, you'll have to use something akin to strace or ltrace
(I don't know what the FreeBSD equivalent is) and look for references to
exec and variations.

strace -o /tmp/passwd.strace passwd
...
grep -w 'exec[0-9a-z]*' /tmp/passwd.strace

You'll then need to determine why the program is invoking these other
executables, decide whether the reasons are acceptable, then enable
access to the acceptable executables.

You might also want to review the files that the program is trying to
open.  In your zeal, you might have inadvertently changed the permissions
on a data file.  You can find these using the output from strace, too:

grep -w 'f?open' /tmp/passwd.strace

-- 
Steve Coile
Systems Administrator
Nando Media
ph: 919-861-1200
fax: 919-861-1300
e-mail: [EMAIL PROTECTED]
http://www.nandomedia.com

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to tailor installation set?

2003-06-13 Thread Steve Coile
On Fri, 13 Jun 2003, Bill Moran wrote:
[...]
 Depends on the component and how the previous admin handled things.  Most
 FreeBSD users use the ports/package system to add/remove programs.  The
 docs are very good:
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html
 
 However, some parts of FreeBSD are part of distribution sets (such as
 man pages, source and ports tree)  I don't know of any automated way to
 remove these from the system.

I guess that's my point.  FreeBSD is pretty big, even without the ports.
My administration philosophy is minimal function set: only install what
will be used.  I'd like a clean way to remove a component--for instance
development tools, or X, or printing support--from the system without
breaking any dependencies.

-- 
Steve Coile
Systems Administrator
Nando Media
ph: 919-861-1200
fax: 919-861-1300
e-mail: [EMAIL PROTECTED]
http://www.nandomedia.com

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


truss man doesn't show *anything*

2003-06-16 Thread Steve Coile
I've just installed a new software package that includes manual pages.
When I try to read the pages with man -M path page, I'm told the
manual page doesn't exist.  When I use truss man -M path page,
truss generates *NO* output.  Is that normal?

-- 
Steve Coile
Systems Administrator
Nando Media
ph: 919-861-1200
fax: 919-861-1300
e-mail: [EMAIL PROTECTED]
http://www.nandomedia.com

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: ssh keepalives

2003-07-02 Thread Steve Coile
On Tue, 1 Jul 2003, Philip J. Koenig wrote:
 I'm having a problem with premature termination of ssh sessions after 
 an idle period of a few minutes, getting a connection reset by peer 
 message.  I presume this is due to intermediate stateful firewalls 
 closing the connection when no traffic passes for a period of time.

Is this a common problem with firewalls?  We suffer from this problem
here, also, and I've thought it must be a misconfiguration with the
firewall or elsewhere in the netwrok.  But since you mentioend it,
I'm rethinking my assessment.

Can someone explain why these connections get dropped?

-- 
Steve Coile
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]