Re: Finding exactly which commands, and in which order, rc is running at startup

2013-08-24 Thread Paul Hoffman
Thanks for all the suggestions. Of them, this was the one that helped me with 
my issue:

On Aug 23, 2013, at 1:41 AM, Doug Hardie bc...@lafn.org wrote:

 You can add:
 
 rc_debug=YES
 
 to /etc/rc.conf and that might give you what you need.  According to the man 
 page it will produces copious output to the terminal and syslog(3)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Finding exactly which commands, and in which order, rc is running at startup

2013-08-23 Thread Matthew Seaman
On 22/08/2013 21:07, Paul Hoffman wrote:
 Greetings again. After doing a freebsd-update, my system is starting
 up differently than it was before. I want to figure out why before I
 come here and say it's broken.
 
 Is there a way to say show me all of the commands you are running
 during startup? It would be grand if I could say tell me what you
 would do next time (dry run), but what did you do last time is OK
 too.

How much detail do you want?  You probably can't get a report on every
single process run during the boot process at all easily.  However, you
can see the console output from the boot process.

To see what the kernel emits on boot-up, look at /var/run/dmesg.boot --
if you've got an old copy of dmesg.boot around somewhere, comparing the
two should show you any changes in the devices the kernel discovers when
it probes your system.

To see the output from the rc system, the best thing is to enable the
console log.  Edit /etc/syslog.conf and uncomment the indicated line, as so:

# uncomment this to log all writes to /dev/console to /var/log/console.log
console.info/var/log/console.log

Then do:

touch /var/log/console.log
chmod 600 /var/log/console.log
/etc/rc.d/syslogd restart

Obviously, that won't help you see what happened on the previous reboot,
but on the next reboot you should see a transcript of the console output.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey




signature.asc
Description: OpenPGP digital signature


Re: Finding exactly which commands, and in which order, rc is running at startup

2013-08-23 Thread Doug Hardie

On 22 August 2013, at 13:07, Paul Hoffman phoff...@proper.com wrote:

 Greetings again. After doing a freebsd-update, my system is starting up 
 differently than it was before. I want to figure out why before I come here 
 and say it's broken.
 
 Is there a way to say show me all of the commands you are running during 
 startup? It would be grand if I could say tell me what you would do next 
 time (dry run), but what did you do last time is OK too.

You can add:

rc_debug=YES

to /etc/rc.conf and that might give you what you need.  According to the man 
page it will produces copious output to the terminal and syslog(3)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Finding exactly which commands, and in which order, rc is running at startup

2013-08-23 Thread Ulrik Søgaard
On 23 August 2013 10:41, Doug Hardie bc...@lafn.org wrote:


 On 22 August 2013, at 13:07, Paul Hoffman phoff...@proper.com wrote:

  Greetings again. After doing a freebsd-update, my system is starting up
 differently than it was before. I want to figure out why before I come here
 and say it's broken.
 
  Is there a way to say show me all of the commands you are running
 during startup? It would be grand if I could say tell me what you would
 do next time (dry run), but what did you do last time is OK too.

 You can add:

 rc_debug=YES

 to /etc/rc.conf and that might give you what you need.  According to the
 man page it will produces copious output to the terminal and syslog(3)
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org


You can use rcorder /etc/rc.d/* /usr/local/etc/rc.d/* to show the order
of which the startup scripts is run.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Finding exactly which commands, and in which order, rc is running at startup

2013-08-22 Thread Paul Hoffman
Greetings again. After doing a freebsd-update, my system is starting up 
differently than it was before. I want to figure out why before I come here and 
say it's broken.

Is there a way to say show me all of the commands you are running during 
startup? It would be grand if I could say tell me what you would do next time 
(dry run), but what did you do last time is OK too.

--Paul Hoffman
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


what commands show memory usage

2013-05-14 Thread Joe

When stopping vnet jails get message about lost memory pages.
What console commands show available memory pages so I can determine the 
lost memory pages after 100 stopped jails?

Want to find out if that lost memory page message is bogus or not.

Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: what commands show memory usage

2013-05-14 Thread Tim Daneliuk

On 05/14/2013 08:56 PM, Joe wrote:

Tim Daneliuk wrote:

On 05/14/2013 08:32 PM, Joe wrote:

When stopping vnet jails get message about lost memory pages.
What console commands show available memory pages so I can determine the lost 
memory pages after 100 stopped jails?
Want to find out if that lost memory page message is bogus or not.



Look at 'vmstat' and 'free' commands.



can't find any free command



Sorry Joe (and everyone), I had a brief bit flip.  The command is
actually called freebsd-memory and is not in the base system.
It's an addon from Ralph Engelshall and can be found here:

   http://people.freebsd.org/~rse/utils/

(If you care, the 'free' command is how you do this on Linux.)

--

Tim Daneliuk tun...@tundraware.com
PGP Key: http://www.tundraware.com/PGP/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Security - logging of user commands

2012-07-26 Thread Damien Fleuriot
On 7/25/12 6:15 PM, jb wrote:
 Damien Fleuriot ml at my.gd writes:
 
 ... 
 From my syslog.conf:
 auth.info;authpriv.info /var/log/auth.log

 Yet I'm seeing not a trail in /var/log/auth.log , or messages, or even
 in secure
 ... 
 
 # less /var/log/auth.log 
 Feb 22 21:13:56 localhost newsyslog[1503]: logfile first created
 Feb 22 21:14:07 localhost login: login on ttyv0 as jb
 Feb 22 21:14:15 localhost su: jb to root on /dev/ttyv0
 ...
 Jul 25 15:23:48 localhost su: jb to root on /dev/pts/3
 Jul 25 17:25:05 localhost snoopy[50059]: [uid:0 sid:45449 tty:/dev/pts/2
 cwd:/usr/ports/security/snoopy filename:/usr/bin/touch]: touch 
 /etc/ld.so.preload 
 Jul 25 17:25:05 localhost snoopy[50060]: [uid:0 sid:45449 tty:/dev/pts/2
 cwd:/usr/ports/security/snoopy filename:/usr/bin/grep]: grep -c
 ^/usr/local/lib//snoopy.so /etc/ld.so.preload 
 Jul 25 17:52:29 localhost snoopy[50145]: [uid:0 sid:46687 tty:/dev/pts/3
 cwd:/usr/home/jb filename:/usr/bin/less]: less /var/log/auth.log 
 Jul 25 17:54:03 localhost snoopy[50148]: [uid:0 sid:46687 tty:/dev/pts/3
 cwd:/usr/home/jb filename:/usr/bin/touch]: touch test1 
 Jul 25 17:54:08 localhost snoopy[50149]: [uid:0 sid:46687 tty:/dev/pts/3
 cwd:/usr/home/jb filename:/usr/bin/less]: less /var/log/auth.log 
 [root@localhost /home/jb]#
 
 jb
 
 


Well, after some digging I am sorry to report that security/snoopy/ is,
imho, quite bugged on 8-STABLE and 9-STABLE alike.



Let's take the example of logging the current working directory:


Below is the statement from ./configure --help :
Optional Features:
[snip]
  --disable-cwd-logging   disable logging of Current Working Directory
  [default=enabled]



From config.h:66
/* Enable logging of Current Working Directory */
/* #undef SNOOPY_CWD_LOGGING */

From configure:4298
#define SNOOPY_CWD_LOGGING 1

From snoopy.c:127
/* Create logMessage */
#if defined(SNOOPY_CWD_LOGGING)



Small edits to snoopy.c to check if current working directory logging is
really enabled:

--- snoopy.c.orig   2012-07-26 10:16:06.0 +
+++ snoopy.c2012-07-26 10:18:05.0 +
@@ -123,12 +123,18 @@
logString[logStringSize-1] = '\0';


+/* Check wether SNOOPY_CWD_LOGGING is _really_ defined or not */
+int cwdlog=0;
+#if defined(SNOOPY_CWD_LOGGING)
+cwdlog=1;
+#endif
+
/* Create logMessage */
#if defined(SNOOPY_CWD_LOGGING)
getCwdRet = getcwd(cwd, PATH_MAX+1);
-   sprintf(logMessage, [uid:%d sid:%d tty:%s cwd:%s filename:%s]: 
%s,
getuid(), getsid(0), ttyPath, cwd, filename, logString);
+   sprintf(logMessage, [uid:%d sid:%d tty:%s cwd:%s filename:%s]: 
%s,
  getuid(), getsid(0), ttyPath, cwd, filename, logString);
#else
-   sprintf(logMessage, [uid:%d sid:%d tty:%s filename:%s]: %s,
getuid(), getsid(0), ttyPath, filename, logString);
+   sprintf(logMessage, cwdlog: %d - [uid:%d sid:%d tty:%s 
filename:%s]:
%s, cwdlog, getuid(), getsid(0), ttyPath, filename, logString);
#endif




And the result:
gmake snoopy.so
setenv LD_PRELOAD /usr/ports/security/snoopy/work/snoopy-1.8.0/snoopy.so
/etc/rc.d/named status


Yields, amongst others:

Jul 26 10:19:00 pf1 snoopy[96561]: cwdlog: 0 - [uid:0 sid:92850
tty:/dev/pts/0 filename:/bin/ps]: /bin/ps -ww -o pid= -o jid= -o
command= -p 1073


Notice how cwdlog is set to 0 which means we don't want to log the
CWD, although configure reports SNOOPY_CWD_LOGGING 1

I think that might not be the only bug, seeing only root actions seem to
be logged although the default should be to log every user.

I'd like to point out that apart from these edits for my tests this is a
*vanilla* install of snoopy.



Might anyone confirm the issue ?

The above is true for 8.1-RELEASE, 8-STABLE , 9-STABLE with snoopy being
at version 1.8.0 on all of them.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Security - logging of user commands

2012-07-26 Thread jb
Damien Fleuriot ml at my.gd writes:

 ... 
 Might anyone confirm the issue ?
 
 The above is true for 8.1-RELEASE, 8-STABLE , 9-STABLE with snoopy being
 at version 1.8.0 on all of them.

$ uname -r
9.0-RELEASE-p3

$ man ldconfig
...
Filenames must conform to the lib*.so.[0-9] pattern in order to
 be added to the hints file.
...
FILES
 /var/run/ld.so.hints Standard hints file for the a.out dynamic
  linker.
 /var/run/ld-elf.so.hints Standard hints file for the ELF dynamic
  linker.
 /etc/ld.so.conf  Conventional configuration file containing
  directory names for invocations with -aout.
 /etc/ld-elf.so.conf  Conventional configuration file containing
  directory names for invocations with -elf.
 /var/run/ld-elf32.so.hints
 /var/run/ld32.so.hints   Conventional configuration files containing
  directory names for invocations with -32.
 /etc/objformat   Determines whether -aout or -elf is the
  default.  If present, it must consist of a
  single line containing either
  `OBJFORMAT=aout' or `OBJFORMAT=elf'.
...
$

# ls -al /usr/local/lib/libsnoopy.so*
lrwxr-xr-x  1 root  wheel14 Jul 26 20:43 /usr/local/lib/libsnoopy.so -
libsnoopy.so.1
-r-xr-xr-x  1 root  wheel  4824 Jul 26 20:07 /usr/local/lib/libsnoopy.so.1

$ grep ldconfig /etc/defaults/rc.conf
...
ldconfig_paths=... /usr/local/lib ...
...

# /etc/rc.d/ldconfig start
...
ldconfig_start()
...
for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
if [ -r ${i} ]; then
_LDC=${_LDC} ${i}
fi
done
check_startmsgs  echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_ins} ${_LDC}
...


$ ldconfig -r
/var/run/ld-elf.so.hints:
search directories:
/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/event2:/usr/local
/lib/gcc46:/usr/local/lib/graphviz:/usr/local/lib/libxul:/usr/local/lib/nss:
/usr/local/lib/pth:/usr/local/lib/qt4
0:-lc.7 = /lib/libc.so.7
...
465:-lsnoopy.1 = /usr/local/lib/libsnoopy.so.1
...
$

# man ldconfig
...
# tail /var/log/auth.log
...
Jul 26 22:12:38 localhost snoopy[5884]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/sbin/sysctl]: /sbin/sysctl -n hw.machine_arch 
Jul 26 22:12:38 localhost snoopy[5885]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/sbin/sysctl]: /sbin/sysctl -n hw.machine 
Jul 26 22:12:38 localhost snoopy[5886]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/usr/bin/locale]: /usr/bin/locale 
Jul 26 22:12:38 localhost snoopy[5889]: [uid:0 sid:2957 tty: cwd:/usr/local/lib
filename:/usr/bin/head]: head -1 
Jul 26 22:12:38 localhost snoopy[5888]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/usr/bin/zcat]: /usr/bin/zcat
/usr/share/man/man8/ldconfig.8.gz 
Jul 26 22:12:38 localhost snoopy[5892]: [uid:0 sid:2957 tty: cwd:/usr/local/lib
filename:/usr/bin/groff]: groff -S -P-h -Wall -mtty-char -man -Tascii -P-c 
Jul 26 22:12:38 localhost snoopy[5891]: [uid:0 sid:2957 tty: cwd:/usr/local/lib
filename:/usr/bin/tbl]: tbl 
Jul 26 22:12:38 localhost snoopy[5890]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/usr/bin/zcat]: /usr/bin/zcat
/usr/share/man/man8/ldconfig.8.gz 
Jul 26 22:12:38 localhost snoopy[5893]: [uid:0 sid:2957 tty: cwd:/usr/local/lib
filename:/usr/bin/more]: more 

# /etc/rc.d/named status
Cannot 'status' named. Set named_enable to YES in /etc/rc.conf or use
'onestatus' instead of 'status'.

# tail /var/log/auth.log
...
Jul 26 22:16:40 localhost snoopy[5917]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/bin/ps]: /bin/ps -ww -p 5916 -o jid= 
Jul 26 22:16:40 localhost snoopy[5919]: [uid:0 sid:2957 tty:/dev/pts/2
cwd:/usr/local/lib filename:/bin/ps]: /bin/ps -ww -o pid= -o jid= -o command= 
-ax 
#

jb






___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Securituy - logging of user commands

2012-07-25 Thread Damien Fleuriot
Hello list,



We're currently working towards the PCI DSS certification (Payment Card
Industry) for a project at work.


One of the prerequisites is that all user commands be logged.

We're currently using a very bad hack that takes the last command from a
user's history and sends it to a log server.

This of course is unreliable as a user may entirely disable their
history, or just use another shell to bypass the csh function or whatever.



My colleagues installed Snoopy on debian and it seems to work wonders as
a module which is LD preloaded.


I notice it also exists on FreeBSD as /usr/ports/security/snoopy .


However I face several problems with it, mainly it doesn't seem to log
anything.



As per the README, I have added /usr/local/lib/snoopy.so to
/etc/ld.so.preload

I'm not even sure this file is used on BSD ?

As per the man page for ld.so there's no such file:
http://www.freebsd.org/cgi/man.cgi?query=ld.so

Neither libmap.conf nor ldconfig(8) seem to be the answer either.



I've googled for ld.so.conf and found the following 2 posts which seem
to indicate it isn't used either:
http://lists.freebsd.org/pipermail/freebsd-hackers/2003-June/001746.html
http://lists.freebsd.org/pipermail/freebsd-hackers/2003-June/001747.html

The posts mention -current but date back from 2003.



Lastly, I have also noticed that the port installs /usr/local/bin/detect
which I executed and would always reply something's fishy.

By looking at the (very short) source I noticed the program merely loads
/lib/libc.so.6 , and it wouldn't find it on my system (8.3-STABLE with
/lib/libc.so.7).
Adjusting and recompiling lets the program correctly print secure but
it does nothing else.

I have checked that the output /usr/local/lib/snoopy.so module is linked
against libc.so.7 , and it is.



Has anyone ever got Snoopy to work on BSD ?
Might I need to install linux emulation ?

Is there any other port that might do the job and which I could use ?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread Damien Fleuriot
No I haven't.

That's a good suggestion, I'll look into it and see if it fits the
purpose :)


On 7/25/12 2:04 PM, Peter Boosten wrote:
 Have you ever considered the audit function of FreeBSD?
 
 
 Peter Boosten
 
 On 25 jul. 2012, at 13:47, Damien Fleuriot m...@my.gd wrote:
 
 Hello list,



 We're currently working towards the PCI DSS certification (Payment Card
 Industry) for a project at work.


 One of the prerequisites is that all user commands be logged.

 We're currently using a very bad hack that takes the last command from a
 user's history and sends it to a log server.

 This of course is unreliable as a user may entirely disable their
 history, or just use another shell to bypass the csh function or whatever.



 My colleagues installed Snoopy on debian and it seems to work wonders as
 a module which is LD preloaded.


 I notice it also exists on FreeBSD as /usr/ports/security/snoopy .


 However I face several problems with it, mainly it doesn't seem to log
 anything.



 As per the README, I have added /usr/local/lib/snoopy.so to
 /etc/ld.so.preload

 I'm not even sure this file is used on BSD ?

 As per the man page for ld.so there's no such file:
 http://www.freebsd.org/cgi/man.cgi?query=ld.so

 Neither libmap.conf nor ldconfig(8) seem to be the answer either.



 I've googled for ld.so.conf and found the following 2 posts which seem
 to indicate it isn't used either:
 http://lists.freebsd.org/pipermail/freebsd-hackers/2003-June/001746.html
 http://lists.freebsd.org/pipermail/freebsd-hackers/2003-June/001747.html

 The posts mention -current but date back from 2003.



 Lastly, I have also noticed that the port installs /usr/local/bin/detect
 which I executed and would always reply something's fishy.

 By looking at the (very short) source I noticed the program merely loads
 /lib/libc.so.6 , and it wouldn't find it on my system (8.3-STABLE with
 /lib/libc.so.7).
 Adjusting and recompiling lets the program correctly print secure but
 it does nothing else.

 I have checked that the output /usr/local/lib/snoopy.so module is linked
 against libc.so.7 , and it is.



 Has anyone ever got Snoopy to work on BSD ?
 Might I need to install linux emulation ?

 Is there any other port that might do the job and which I could use ?
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread Peter Boosten
Have you ever considered the audit function of FreeBSD?


Peter Boosten

On 25 jul. 2012, at 13:47, Damien Fleuriot m...@my.gd wrote:

 Hello list,
 
 
 
 We're currently working towards the PCI DSS certification (Payment Card
 Industry) for a project at work.
 
 
 One of the prerequisites is that all user commands be logged.
 
 We're currently using a very bad hack that takes the last command from a
 user's history and sends it to a log server.
 
 This of course is unreliable as a user may entirely disable their
 history, or just use another shell to bypass the csh function or whatever.
 
 
 
 My colleagues installed Snoopy on debian and it seems to work wonders as
 a module which is LD preloaded.
 
 
 I notice it also exists on FreeBSD as /usr/ports/security/snoopy .
 
 
 However I face several problems with it, mainly it doesn't seem to log
 anything.
 
 
 
 As per the README, I have added /usr/local/lib/snoopy.so to
 /etc/ld.so.preload
 
 I'm not even sure this file is used on BSD ?
 
 As per the man page for ld.so there's no such file:
 http://www.freebsd.org/cgi/man.cgi?query=ld.so
 
 Neither libmap.conf nor ldconfig(8) seem to be the answer either.
 
 
 
 I've googled for ld.so.conf and found the following 2 posts which seem
 to indicate it isn't used either:
 http://lists.freebsd.org/pipermail/freebsd-hackers/2003-June/001746.html
 http://lists.freebsd.org/pipermail/freebsd-hackers/2003-June/001747.html
 
 The posts mention -current but date back from 2003.
 
 
 
 Lastly, I have also noticed that the port installs /usr/local/bin/detect
 which I executed and would always reply something's fishy.
 
 By looking at the (very short) source I noticed the program merely loads
 /lib/libc.so.6 , and it wouldn't find it on my system (8.3-STABLE with
 /lib/libc.so.7).
 Adjusting and recompiling lets the program correctly print secure but
 it does nothing else.
 
 I have checked that the output /usr/local/lib/snoopy.so module is linked
 against libc.so.7 , and it is.
 
 
 
 Has anyone ever got Snoopy to work on BSD ?
 Might I need to install linux emulation ?
 
 Is there any other port that might do the job and which I could use ?
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread jb
Damien Fleuriot ml at my.gd writes:

 ... 
 I notice it also exists on FreeBSD as /usr/ports/security/snoopy .
 
 However I face several problems with it, mainly it doesn't seem to log
 anything.
 
 As per the README, I have added /usr/local/lib/snoopy.so to
 /etc/ld.so.preload
 
 I'm not even sure this file is used on BSD ?
 ...

/usr/ports/security/snoopy]# make clean; make
...
# ls work/snoopy-1.8.0/
...
enable.sh
...

jb

  


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread Damien Fleuriot

On 7/25/12 2:42 PM, jb wrote:
 Damien Fleuriot ml at my.gd writes:
 
 ... 
 I notice it also exists on FreeBSD as /usr/ports/security/snoopy .

 However I face several problems with it, mainly it doesn't seem to log
 anything.

 As per the README, I have added /usr/local/lib/snoopy.so to
 /etc/ld.so.preload

 I'm not even sure this file is used on BSD ?
 ...
 
 /usr/ports/security/snoopy]# make clean; make
 ...
 # ls work/snoopy-1.8.0/
 ...
 enable.sh
 ...
 
 jb
 


Well that's my problem exactly, really.

1/ the enable script won't work and will always return an error,
requiring a manual activation
2/ even once enabled, snoopy doesn't get loaded because
/etc/ld.so.preload is not used on FBSD apparently
3/ even when enabled with setenv LD_PRELOAD /usr/local/lib/snoopy.so,
snoopy won't return any log



From config.h:
/* Syslog facility to use */
#define SNOOPY_SYSLOG_FACILITY LOG_AUTHPRIV

/* Syslog level to use */
#define SNOOPY_SYSLOG_LEVEL LOG_INFO


From my syslog.conf:
auth.info;authpriv.info /var/log/auth.log

Yet I'm seeing not a trail in /var/log/auth.log , or messages, or even
in secure


I have however validated that snoopy.so is called, as per the following:

# truss ls /dev/null
[snip]
open(/usr/local/lib/snoopy.so,O_RDONLY,031)= 2 (0x2)
fstat(2,{ mode=-r-xr-xr-x ,inode=548761,size=6952,blksize=16384 }) = 0 (0x0)
fstatfs(0x2,0x7fffe220,0x19,0x0,0x80080053a068,0x0) = 0 (0x0)
pread(0x2,0x80063e2a0,0x1000,0x0,0x80080053a068,0x0) = 4096 (0x1000)
mmap(0x0,1056768,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) =
34366341120 (0x80064c000)
mmap(0x80064c000,8192,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE,2,0x0)
= 34366341120 (0x80064c000)
mmap(0x80074d000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,2,0x1000)
= 34367393792 (0x80074d000)
close(2) = 0 (0x0)


And still no logs...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread Victor Sudakov
Peter Boosten wrote:
 Have you ever considered the audit function of FreeBSD?

Does it really log user commands? At best, it logs executed processes.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
sip:suda...@sibptus.tomsk.ru
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread jb
Damien Fleuriot ml at my.gd writes:

 ... 
 From my syslog.conf:
 auth.info;authpriv.info /var/log/auth.log
 
 Yet I'm seeing not a trail in /var/log/auth.log , or messages, or even
 in secure
 ... 

# less /var/log/auth.log 
Feb 22 21:13:56 localhost newsyslog[1503]: logfile first created
Feb 22 21:14:07 localhost login: login on ttyv0 as jb
Feb 22 21:14:15 localhost su: jb to root on /dev/ttyv0
...
Jul 25 15:23:48 localhost su: jb to root on /dev/pts/3
Jul 25 17:25:05 localhost snoopy[50059]: [uid:0 sid:45449 tty:/dev/pts/2
cwd:/usr/ports/security/snoopy filename:/usr/bin/touch]: touch 
/etc/ld.so.preload 
Jul 25 17:25:05 localhost snoopy[50060]: [uid:0 sid:45449 tty:/dev/pts/2
cwd:/usr/ports/security/snoopy filename:/usr/bin/grep]: grep -c
^/usr/local/lib//snoopy.so /etc/ld.so.preload 
Jul 25 17:52:29 localhost snoopy[50145]: [uid:0 sid:46687 tty:/dev/pts/3
cwd:/usr/home/jb filename:/usr/bin/less]: less /var/log/auth.log 
Jul 25 17:54:03 localhost snoopy[50148]: [uid:0 sid:46687 tty:/dev/pts/3
cwd:/usr/home/jb filename:/usr/bin/touch]: touch test1 
Jul 25 17:54:08 localhost snoopy[50149]: [uid:0 sid:46687 tty:/dev/pts/3
cwd:/usr/home/jb filename:/usr/bin/less]: less /var/log/auth.log 
[root@localhost /home/jb]#

jb


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Securituy - logging of user commands

2012-07-25 Thread Damien Fleuriot

On 25 Jul 2012, at 18:15, jb jb.1234a...@gmail.com wrote:

 Damien Fleuriot ml at my.gd writes:
 
 ... 
 From my syslog.conf:
 auth.info;authpriv.info /var/log/auth.log
 
 Yet I'm seeing not a trail in /var/log/auth.log , or messages, or even
 in secure
 ... 
 
 # less /var/log/auth.log 
 Feb 22 21:13:56 localhost newsyslog[1503]: logfile first created
 Feb 22 21:14:07 localhost login: login on ttyv0 as jb
 Feb 22 21:14:15 localhost su: jb to root on /dev/ttyv0
 ...
 Jul 25 15:23:48 localhost su: jb to root on /dev/pts/3
 Jul 25 17:25:05 localhost snoopy[50059]: [uid:0 sid:45449 tty:/dev/pts/2
 cwd:/usr/ports/security/snoopy filename:/usr/bin/touch]: touch 
 /etc/ld.so.preload 
 Jul 25 17:25:05 localhost snoopy[50060]: [uid:0 sid:45449 tty:/dev/pts/2
 cwd:/usr/ports/security/snoopy filename:/usr/bin/grep]: grep -c
 ^/usr/local/lib//snoopy.so /etc/ld.so.preload 
 Jul 25 17:52:29 localhost snoopy[50145]: [uid:0 sid:46687 tty:/dev/pts/3
 cwd:/usr/home/jb filename:/usr/bin/less]: less /var/log/auth.log 
 Jul 25 17:54:03 localhost snoopy[50148]: [uid:0 sid:46687 tty:/dev/pts/3
 cwd:/usr/home/jb filename:/usr/bin/touch]: touch test1 
 Jul 25 17:54:08 localhost snoopy[50149]: [uid:0 sid:46687 tty:/dev/pts/3
 cwd:/usr/home/jb filename:/usr/bin/less]: less /var/log/auth.log 
 [root@localhost /home/jb]#
 
 jb
 

Thanks for taking the time to show me it works, at least for you.

What fbsd and snoopy version might these be ?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Ports-Related Commands Hanging After 9.0 Upgrade

2012-05-25 Thread Sam Jones
Hi all,

Forgive me if this is a repeat topic. I'd appreciate it if somebody
could point me to the answer.

I recently upgraded to 9.0 on my server, but since then a lot of
ports-related commands (portupgrade, pkg_version, portsnap, etc.) just
hang when I try to execute them. I'm not even really sure where to
begin troubleshooting. Has anybody else seen this behavior?

-- 
Sam Jones
samjones1...@gmail.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Ports-Related Commands Hanging After 9.0 Upgrade

2012-05-25 Thread Christopher J. Ruwe
On Fri, 25 May 2012 13:33:29 -0400
Sam Jones samjones1...@gmail.com wrote:

 Hi all,
 
 Forgive me if this is a repeat topic. I'd appreciate it if somebody
 could point me to the answer.
 
 I recently upgraded to 9.0 on my server, but since then a lot of
 ports-related commands (portupgrade, pkg_version, portsnap, etc.) just
 hang when I try to execute them. I'm not even really sure where to
 begin troubleshooting. Has anybody else seen this behavior?
 

Upgrading world leads to many system libs being updated, too. When ports
are dependant on these, a recompile of these ports might help.

If you need/want to be sure, sysutils/bsdadminscripts is supposed to
contain a script to check for broken shared libs system-wide and a
ldd(1) on the binary you are trying to run will spit out some libraries
you can the try to find(1).

Hope to have been of some help, cheers, Christopher
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: The results of your email commands

2011-11-20 Thread thanos trompoukis
I saw that the usb device is like a scsi  da
so now I am trying this:
# mount -t msdosfs /dev/da0 /mnt/usb
mount_msdosfs: /dev/da0: Invalid argument
now what?  how I have to refered on my usb device?
I do not understand a word here!



thanx!




2011/11/19 owner-freebsd-questi...@freebsd.org

 The results of your email command are provided below. Attached is your
 original message.

 - Results:
Ignoring non-text/plain MIME parts

 - Unprocessed:
doing the follow:
First I am giving:  mkdir mnt/usb
and then I am giving: mount -t msdos /dev/usb /mnt/usb
but I am seeing this on my screen:
mount: Using -t msdosfs, since -t msdos is deprecated.
mount_msdosfs: /dev/usb: Block device required
I also trying:  mount -t msdosfs /dev/usb /mnt/usb
But I am getting the same message:
mount_msdosfs: /dev/usb: Block device required
Any suggestions please? Because I am lost here, I have NO idea...
Thanx!

 - Done.



 -- Messaggio inoltrato --
 From: thanos trompoukis atr0...@gmail.com
 To: freebsd-questions-requ...@freebsd.org
 Date: Sat, 19 Nov 2011 17:33:09 +0200
 Subject: Can't mount usb disk
 Hi, I have freebsd 8.2  and I am trying to mount an external usb disk
 doing the follow:

 First I am giving:  mkdir mnt/usb

 and then I am giving: mount -t msdos /dev/usb /mnt/usb

 but I am seeing this on my screen:
 mount: Using -t msdosfs, since -t msdos is deprecated.
 mount_msdosfs: /dev/usb: Block device required


 I also trying:  mount -t msdosfs /dev/usb /mnt/usb
 But I am getting the same message:
 mount_msdosfs: /dev/usb: Block device required



 Any suggestions please? Because I am lost here, I have NO idea...


 Thanx!


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: The results of your email commands

2011-11-20 Thread Polytropon
On Sun, 20 Nov 2011 13:17:23 +0200, thanos trompoukis wrote:
 I saw that the usb device is like a scsi  da
 so now I am trying this:
 # mount -t msdosfs /dev/da0 /mnt/usb
 mount_msdosfs: /dev/da0: Invalid argument
 now what?  how I have to refered on my usb device?
 I do not understand a word here!

Depending on he partitioning of the USB media,
it's possible to access /dev/da0s1 instead of
/dev/da0. The command

# fdisk da0

lists the partitioning information. According
to the example above, you can

# mount -t msdosfs /dev/da0s1 /mnt/usb

There is a section in the FreeBSD Handbook
discussing the topic of how to access MS-DOS
formatted media per USB.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: The results of your email commands

2011-11-20 Thread Robert Bonomi
 From owner-freebsd-questi...@freebsd.org  Sun Nov 20 05:44:42 2011
 Date: Sun, 20 Nov 2011 13:17:23 +0200
 From: thanos trompoukis atr0...@gmail.com
 To: freebsd-questions@freebsd.org
 Subject: Re: The results of your email commands

 I saw that the usb device is like a scsi  da
 so now I am trying this:
 # mount -t msdosfs /dev/da0 /mnt/usb
 mount_msdosfs: /dev/da0: Invalid argument
 now what?  how I have to refered on my usb device?
 I do not understand a word here!

The following is a 'catch *everything*' approch.
There are less-drastic ways,  bud you don't provide enough
information to determine what short-cuts are possible.

*FIRST* _shut_down_ the machine.
Next, remove the USB device.
Now, turn on the machine and boot into FreeBSD.
Do an 'ls -l' of the /dev directory.  save the output to a file in your home
directory.
Plug in the USB device.
Did you get system log and/or console messages about a new USB device?
 (if not, you may be missing USB device suport from the kernel0
Again, do an 'ls -l' of the /dev directoy.  Save the output to a *differnt*
file in your home directory.
Look for device entries that are mentioned in _this_ list, that are *not* in
the list you got when the USB device was not connected.

*THOSE* are the possible devices for the 'mount' command you are trying.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


bash can not find most of my commands

2011-02-22 Thread Alokat

Hi,

I have changed my shell from csh to bash ...
But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)

my /root/.profile:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin
export PATH
HOME=/root
export HOME
TERM=${TERM:-cons25}
export TERM
PAGER=more
export PAGER

Regards,
Alokat
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Rolf Nielsen

2011-02-22 17:40, Alokat skrev:

Hi,

I have changed my shell from csh to bash ...


Why?
Do you use root as your regular login?


But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)

my /root/.profile:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin

export PATH
HOME=/root
export HOME
TERM=${TERM:-cons25}
export TERM
PAGER=more
export PAGER

Regards,
Alokat
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Alokat

On 02/22/11 17:44, Rolf Nielsen wrote:

2011-02-22 17:40, Alokat skrev:

Hi,

I have changed my shell from csh to bash ...


Why?
Do you use root as your regular login?


But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)

my /root/.profile:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin 



export PATH
HOME=/root
export HOME
TERM=${TERM:-cons25}
export TERM
PAGER=more
export PAGER

Regards,
Alokat
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org

It's just for example ... :)
I have a non root login for regular stuff.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Paul Macdonald

On 22/02/2011 16:40, Alokat wrote:

Hi,

I have changed my shell from csh to bash ...
But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)


don't change your root shell!

csh is in the base system so is safe and will always* work,

bash is a port and gets updated regularly, there's been at least one 
occasion when my bash upgrade failed and i couln't login as root.  very 
frustrating..


I just get used to changing to bash after that, much safer!

Paul.



--
-
Paul Macdonald
IFDNRG Ltd
Web and video hosting
-
t: 0131 5548070
m: 07534206249
e: p...@ifdnrg.com
w: http://www.ifdnrg.com
-
IFDNRG
40 Maritime Street
Edinburgh
EH6 6SA
-


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Rolf G Nielsen

2011-02-22 17:47, Alokat skrev:

On 02/22/11 17:44, Rolf Nielsen wrote:

2011-02-22 17:40, Alokat skrev:

Hi,

I have changed my shell from csh to bash ...


Why?
Do you use root as your regular login?


But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)

my /root/.profile:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin


export PATH
HOME=/root
export HOME
TERM=${TERM:-cons25}
export TERM
PAGER=more
export PAGER

Regards,
Alokat
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org

It's just for example ... :)
I have a non root login for regular stuff.


To me the .profile looks ok, and I can't really say why it doesn't work.
However, do not use a shell that's not in the base system for root. Some 
would point security issues, but I don't know much about those when it 
comes to bash, however, if you need to boot into single user, you may 
get into troubles with a shell not in base.



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Alokat

On 02/22/11 17:49, Paul Macdonald wrote:

On 22/02/2011 16:40, Alokat wrote:

Hi,

I have changed my shell from csh to bash ...
But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)


don't change your root shell!

csh is in the base system so is safe and will always* work,

bash is a port and gets updated regularly, there's been at least one 
occasion when my bash upgrade failed and i couln't login as root.  
very frustrating..


I just get used to changing to bash after that, much safer!

Paul.




Paul has satisfied me. I have changed back to csh.

Thank for help.

Regards,
alokat
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Randy Ramsdell

Alokat wrote:

On 02/22/11 17:49, Paul Macdonald wrote:

On 22/02/2011 16:40, Alokat wrote:

Hi,

I have changed my shell from csh to bash ...
But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)


don't change your root shell!

csh is in the base system so is safe and will always* work,

bash is a port and gets updated regularly, there's been at least one 
occasion when my bash upgrade failed and i couln't login as root.  
very frustrating..


I just get used to changing to bash after that, much safer!

Paul.




Paul has satisfied me. I have changed back to csh.

Thank for help.

Regards,
alokat



And if you use bash after login or anytime, your original problem remains.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Jason Helfman

On Tue, Feb 22, 2011 at 12:08:30PM -0500, Randy Ramsdell thus spake:

Alokat wrote:

On 02/22/11 17:49, Paul Macdonald wrote:

On 22/02/2011 16:40, Alokat wrote:

Hi,

I have changed my shell from csh to bash ...
But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)


don't change your root shell!

csh is in the base system so is safe and will always* work,

bash is a port and gets updated regularly, there's been at least one
occasion when my bash upgrade failed and i couln't login as root.
very frustrating..

I just get used to changing to bash after that, much safer!

Paul.




Paul has satisfied me. I have changed back to csh.

Thank for help.

Regards,
alokat



And if you use bash after login or anytime, your original problem remains.


This has to do with your path, and it is known good practice to use full
paths, as well.

-jgh
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Lars Eighner

On Tue, 22 Feb 2011, Alokat wrote:


Paul has satisfied me. I have changed back to csh.


If you want to run as root and use bash, well, that is what the user toor is
for (examine master.passwd -- use vipw to edit master.passwd to enter a
password for toor and the path to bash for toor, but set EDITOR first if you
are not comfortable with vi).  If you activate toor, you can log in as toor,
use bash, and yet you are root (try whoami as toor).  This preserves the
root login for emergencies when /usr may not be mounted.

--
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Warren Block

On Tue, 22 Feb 2011, Paul Macdonald wrote:


On 22/02/2011 16:40, Alokat wrote:

Hi,

I have changed my shell from csh to bash ...
But after that I have to call reboot like /sbin/reboot.

How can I change that without changing the shell. :)


don't change your root shell!

csh is in the base system so is safe and will always* work,

bash is a port and gets updated regularly, there's been at least one occasion 
when my bash upgrade failed and i couln't login as root.  very frustrating..


I just get used to changing to bash after that, much safer!


Consider running bash from .cshrc.  Less breakable than changing root's 
shell, but still kind of automatic.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Chad Perrin
On Tue, Feb 22, 2011 at 05:58:22PM +0100, Alokat wrote:

 Paul has satisfied me. I have changed back to csh.

Your system should have a toor account as well.  It is just a second
root account, whose essential purpose is to provide a root account that
you can fiddle with to your heart's content without endangering the main
root account.  Note that the toor account can break things on the system
just as much as the root account; if you break the toor account itself,
though, you still have access to the main root account to get yourself
out of trouble.

Thus, if you *really* want a superuser account with bash as its default
shell, you can always use toor for that purpose.  I don't much see the
point in setting a superuser account to use bash anyway -- or any other
account, really -- but the option is there if you must have it.  Just
don't change the shell for the root account itself that way; it's bad for
you, with lots of fatty calories, preservatives, artificial sweeteners,
and other stuff your body should not be ingesting on a regular basis.

-- 
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]


pgpQg5oXnDcAV.pgp
Description: PGP signature


Re: bash can not find most of my commands

2011-02-22 Thread David Brodbeck
On Tue, Feb 22, 2011 at 9:53 AM, Chad Perrin per...@apotheon.com wrote:
 Thus, if you *really* want a superuser account with bash as its default
 shell, you can always use toor for that purpose.  I don't much see the
 point in setting a superuser account to use bash anyway -- or any other
 account, really -- but the option is there if you must have it.

It turns out auto-completion with hinting and command history
searching are pretty addictive if you're used to having them. :)

Personally, I usually just use sudo, or run bash as my first command
after gaining root powers.  But it's very interesting to finally find
out what toor is for.  I'd always wondered.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Chad Perrin
On Tue, Feb 22, 2011 at 10:07:54AM -0800, David Brodbeck wrote:
 On Tue, Feb 22, 2011 at 9:53 AM, Chad Perrin per...@apotheon.com wrote:
 
 It turns out auto-completion with hinting and command history
 searching are pretty addictive if you're used to having them. :)

I have auto-completion, and I know my environment well enough that hints
aren't generally helpful.


 
 Personally, I usually just use sudo, or run bash as my first command
 after gaining root powers.  But it's very interesting to finally find
 out what toor is for.  I'd always wondered.

Glad to be of some help.

Just do us all a favor; don't write code in bash.  Use Bourne shell (sh,
not bash), or a real programming language (Perl, Ruby, Python,
whatever).  The bash option essentially tries to capture the power of
such real languages, but does a very bad job of it -- and gives up the
nigh-universal portability across Unix-like systems to do so.  It's the
worst of all worlds.

-- 
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]


pgpwBJdOKArNp.pgp
Description: PGP signature


Re: bash can not find most of my commands

2011-02-22 Thread David Brodbeck
On Tue, Feb 22, 2011 at 12:39 PM, Chad Perrin per...@apotheon.com wrote:
 Just do us all a favor; don't write code in bash.

Yeah, I try to avoid bash-specific syntax unless it's for one-off
scripts.  csh suffers the same kinds of problems; I only write csh
code under extreme duress, like when forced to maintain the
system-wide csh.login script. ;)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash can not find most of my commands

2011-02-22 Thread Chad Perrin
On Tue, Feb 22, 2011 at 01:10:20PM -0800, David Brodbeck wrote:
 
 Yeah, I try to avoid bash-specific syntax unless it's for one-off
 scripts.  csh suffers the same kinds of problems; I only write csh
 code under extreme duress, like when forced to maintain the
 system-wide csh.login script. ;)

I often use tcsh as an interactive shell, but I do not use it for shell
scripts.

-- 
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]


pgpW4w3idg6aw.pgp
Description: PGP signature


Re: bash can not find most of my commands

2011-02-22 Thread Chip Camden
Quoth David Brodbeck on Tuesday, 22 February 2011:
 On Tue, Feb 22, 2011 at 12:39 PM, Chad Perrin per...@apotheon.com wrote:
  Just do us all a favor; don't write code in bash.

What's with all the bash bashing?

Sorry, couldn't resist.

 
 Yeah, I try to avoid bash-specific syntax unless it's for one-off
 scripts.  csh suffers the same kinds of problems; I only write csh
 code under extreme duress, like when forced to maintain the
 system-wide csh.login script. ;)

At least sh scripts will execute correctly under bash -- they don't
always under csh/tcsh.

I like zsh for a command-line shell, but when writing scripts for general
usage I stick with the sh-compatibile subset of capabilities, and I enforce
that on myself with the #!/bin/sh shebang.  If I need more than what that
can gracefully do, I usually run to the arms of Ruby.

-- 
Sterling (Chip) Camden | sterl...@camdensoftware.com | 2048D/3A978E4F
http://chipsquips.com  | http://camdensoftware.com   | http://chipstips.com


pgpISYvMSTcjg.pgp
Description: PGP signature


Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Bernard Scharp
Hi all,

I'm having some problems with a bash script.

It's a backup script that periodically checks if a list of systems is
online, and if so, uses samba to mount a specified list of shares,
rsyncs them to a local directory and unmounts again.

This used to run fine till a few months ago (I don't know what the
trigger was that caused them to first fail).

Now, when the script is run, it gives the following error when mounting
the shares:

mount_smbfs: can't get handle to requester (no /dev/nsmb* device)

Which is strange, as there are (by last count) 1170 /dev/nsmb* devices
in /dev/ (is that normal?)

Searching the internet, FreeBSD and Samba mailing lists gave me no
recent info, and the old info wasn't helpful.

I've narrowed it down to the point where I think it's caused by one
process trying to open two (or more) shares at the same time. (a simple
script mounting two shares gives the same error).

I can mount the shares from the command line without problems, it's only
in the bash script it gives me problems.

~/.nsmbrc and /etc/nsmb.conf are correct, smbd, nmbd and winbindd are
running. The system is FreeBSD 8.0 Stable.

Anyone got any suggestions?

Regards,
Bernard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Jerry
On Thu, 02 Sep 2010 10:24:05 +0200
Bernard Scharp freebsd-questi...@itsacon.net articulated:

 Hi all,
 
 I'm having some problems with a bash script.
 
 It's a backup script that periodically checks if a list of systems is
 online, and if so, uses samba to mount a specified list of shares,
 rsyncs them to a local directory and unmounts again.
 
 This used to run fine till a few months ago (I don't know what the
 trigger was that caused them to first fail).
 
 Now, when the script is run, it gives the following error when
 mounting the shares:
 
 mount_smbfs: can't get handle to requester (no /dev/nsmb* device)
 
 Which is strange, as there are (by last count) 1170 /dev/nsmb* devices
 in /dev/ (is that normal?)
 
 Searching the internet, FreeBSD and Samba mailing lists gave me no
 recent info, and the old info wasn't helpful.
 
 I've narrowed it down to the point where I think it's caused by one
 process trying to open two (or more) shares at the same time. (a
 simple script mounting two shares gives the same error).
 
 I can mount the shares from the command line without problems, it's
 only in the bash script it gives me problems.
 
 ~/.nsmbrc and /etc/nsmb.conf are correct, smbd, nmbd and winbindd are
 running. The system is FreeBSD 8.0 Stable.
 
 Anyone got any suggestions?

Could you post the script? Anything else would be pure guess work. You
also might consider posting this on the BASH mail forum:

bug-b...@gnu.org

although you might have to subscribe first:

http://lists.gnu.org/mailman/listinfo/bug-bash

-- 
Jerry ✌
freebsd.u...@seibercom.net

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__

Vital papers will demonstrate their vitality by spontaneously moving
from where you left them to where you can't find them.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Bernard Scharp

 
 Could you post the script? Anything else would be pure guess work. You

Well, I can recreate it with something as simple as:

#!/usr/local/bin/bash
mount_smbfs //u...@remotehost/share1/ /tmp/mnt/
mount_smbfs //u...@remotehost/share2/ /tmp/mnt2/


 also might consider posting this on the BASH mail forum:
 
   bug-b...@gnu.org
 
 although you might have to subscribe first:
 
   http://lists.gnu.org/mailman/listinfo/bug-bash
 

I'l look into that, (though I doubt this is a bash issue).

Thanks!
Bernard

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Polytropon
On Thu, 02 Sep 2010 14:02:35 +0200, Bernard Scharp 
freebsd-questi...@itsacon.net wrote:
 
  
  Could you post the script? Anything else would be pure guess work. You
 
 Well, I can recreate it with something as simple as:
 
 #!/usr/local/bin/bash
 mount_smbfs //u...@remotehost/share1/ /tmp/mnt/
 mount_smbfs //u...@remotehost/share2/ /tmp/mnt2/

Excuse me, it may just be a stupid question... but... why do
you use bash for this purpose? Do you require any special
bash feature that cannot be done using the standard shell,
sh? I often see the urge to use bash for scripting as a
typical Linuxism, which is usually non-portable (if that
was your goal). FreeBSD's standard scripting shell is sh,
so why not use it until you reach the ends of its functionality?



Just a guess, regarding your initial question, as I don't have
experience with Windows related things: Did you have the
chance to monitor correct operations of your script in the
past? Did the mound and umount (!) calls work properly? Have
you checked your commands running them in the standard dialog
shell (csh)? I assume you're running them as root (or at least
with sufficient permissions), so I don't think the problem
is there, as the error message

mount_smbfs: can't get handle to requester (no /dev/nsmb* device)

doesn't look like refering to that problem.

The error message originates from /usr/src/contrib/smbfs/lib/smb/ctx.c;
having a look around, and remembering that you said

 [...] there are (by last count) 1170 /dev/nsmb* devices
 in /dev/ (is that normal?)

I found smb_ctx_gethandle() near line 600 (version 7 OS here):

/*
 * well, no clone capabilities available - we have to scan
 * all devices in order to get free one
 */
 for (i = 0; i  1024; i++) {
 snprintf(buf, sizeof(buf), /dev/%s%d, NSMB_NAME, i);
 fd = open(buf, O_RDWR);
 if (fd = 0) {
ctx-ct_fd = fd;
return 0;
 }
 }

The limit seems to be 1024, if I read that correctly - allthough
I'm considered a C hacker, I'm no OS-level C hacker. :-)

Afterwards, smb_ctx_lookup() fails and gives the error message
mentioned earlier.

Remove the /dev/nsmb* devices and try again. Make sure no other
SMB stuff is currently mounted, just to be sure, as I don't have
any idea what could fail.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Bernard Scharp
On 02/09/2010 15:29, Polytropon wrote:
 On Thu, 02 Sep 2010 14:02:35 +0200, Bernard Scharp 
 freebsd-questi...@itsacon.net wrote:


 Could you post the script? Anything else would be pure guess work. You

 Well, I can recreate it with something as simple as:

 #!/usr/local/bin/bash
 mount_smbfs //u...@remotehost/share1/ /tmp/mnt/
 mount_smbfs //u...@remotehost/share2/ /tmp/mnt2/
 
 Excuse me, it may just be a stupid question... but... why do
 you use bash for this purpose? Do you require any special
 bash feature that cannot be done using the standard shell,
 sh? I often see the urge to use bash for scripting as a
 typical Linuxism, which is usually non-portable (if that
 was your goal). FreeBSD's standard scripting shell is sh,
 so why not use it until you reach the ends of its functionality?

The script above is a (heavily) reduced version, used to isolate the
problem. The real script is much longer, and uses a bunch of logic to
walk through a list of different systems (each with their own lists of
shares, loaded from external files), taking snapshots of the previous
backup, logging which systems were backed up, rolling back operations if
a backup fails, etc.

 Just a guess, regarding your initial question, as I don't have
 experience with Windows related things: Did you have the
 chance to monitor correct operations of your script in the
 past? Did the mound and umount (!) calls work properly? Have
 you checked your commands running them in the standard dialog
 shell (csh)? I assume you're running them as root (or at least
 with sufficient permissions), so I don't think the problem
 is there, as the error message
 
 mount_smbfs: can't get handle to requester (no /dev/nsmb* device)
 
 doesn't look like refering to that problem.

I am running it as root, and I just tried running the (test)script
(without the bash reference) under a csh shell, and got the same error,
so it's not a bash problem.

As for monitoring the operations of the script, it has worked fine
before (for several years), so I'm pretty sure the code is correct.

 
 The error message originates from /usr/src/contrib/smbfs/lib/smb/ctx.c;
 having a look around, and remembering that you said
 
 [...] there are (by last count) 1170 /dev/nsmb* devices
 in /dev/ (is that normal?)
 
 I found smb_ctx_gethandle() near line 600 (version 7 OS here):
 
 /*
  * well, no clone capabilities available - we have to scan
  * all devices in order to get free one
  */
  for (i = 0; i  1024; i++) {
  snprintf(buf, sizeof(buf), /dev/%s%d, NSMB_NAME, i);
  fd = open(buf, O_RDWR);
  if (fd = 0) {
 ctx-ct_fd = fd;
 return 0;
  }
  }
 
 The limit seems to be 1024, if I read that correctly - allthough
 I'm considered a C hacker, I'm no OS-level C hacker. :-)

Neither am I. Hadn't even thought of grepping in /usr/src for the error
message :-)

 
 Afterwards, smb_ctx_lookup() fails and gives the error message
 mentioned earlier.
 
 Remove the /dev/nsmb* devices and try again. Make sure no other
 SMB stuff is currently mounted, just to be sure, as I don't have
 any idea what could fail.
 

Can I just `rm /dev/nsmbX` them? (messing in /dev/ is a level of FreeBSD
I'm not familiar with)

Thanks for all your help!

Bernard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Polytropon
On Thu, 02 Sep 2010 15:52:25 +0200, Bernard Scharp 
freebsd-questi...@itsacon.net wrote:
 Neither am I. Hadn't even thought of grepping in /usr/src for the error
 message :-)

It's often a good starting point to see where problems might
be caused from.



 Can I just `rm /dev/nsmbX` them? (messing in /dev/ is a level of FreeBSD
 I'm not familiar with)

Yes, I would guess so. The content of /dev/ is dynamically generated
since FreeBSD 5, if I remember correctly. As the nsmb nodes don't
seem to be in use any longer, it would be no problem to remove
them. The mount_smbfs program will generate them if needed.

Just as an addition: After your script successfully performed the
operations needing the mounted SMB shares, it could remove the
corresponding device files.

Still, this looks like a bug to me, a can't image anybody needs more
than 1024 of them kind of bug. I would have imagined that IF a
program needs files in a temporary way, it removes them after use.

Just to be sure, unmount all SMB related things, as I can't predict
what would happen if a nsmb device disappears when in use.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Howto run privileged commands on login/logout

2010-02-07 Thread Polytropon
On Sun, 07 Feb 2010 01:55:02 +0100, Erik Norgaard norga...@locolomo.org wrote:
 Hi:
 
 I'm playing around with diskless operation. I'd like to be able to run 
 privileged commands when a user logins or logs out:

You can handle this in two ways:

a) On a per-user basis, you can use the user's ~/.login and
   ~/.logout files; those are corresponding to the C Shell,
   and assuming that csh is the dialog shell for the user.

b) On an all-users basis, you can use /etc/csh.login and
   /etc/csh.logout to have all users perform the commands
   you want to run.



 - on login, nfs mount the user's home directory (ok, not critical, I can 
 mount /home)

As it has already been mentioned, it is easy to use amd
and / or automounter tool for that.



 - on logout a system reboot to clean up any temporary files left from 
 the session.

A system reboot? To clean up temporary files? Caused by
an ordinary user? Excuse me, Sir, what strange country
are you from? :-)

Honestly, that's not neccessary. If you want to make sure
that all temporary files belonging to a specific user are
deleted upon user logout, you can simply let him do it by
his ~/.logout script, e. g. using rm -rf /tmp; this might
sound very violent, but it will only delete the user's
files from the /tmp subtree.

There are very few occassions you HAVE to reboot a BSD machine.
Cleaning temporary files is *not* one of them, especially
if you don't have clear_tmp_enable set to YES in /etc/rc.conf.

If temporary files are left in other directories you know
of, you can clean them as well.



 Is this possible, without messing arround with sudo or adding users to 
 wheel or operator groups?

Of course. You can edit the permissions for the programs
you explicitely want to allow ordinary users to run,
e. g. the /sbin/shutdown binary.



A sidenote: If we're talking about X, the GiveConsole and
TakeConsole in /usr/local/lib/X11/xdm/ can be used. Those
are shell scripts that allow chown'ing and chmod'ing files
to specific users, as well as other things.

I know that a problem may occur when multiple users log in.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Howto run privileged commands on login/logout

2010-02-06 Thread Erik Norgaard

Hi:

I'm playing around with diskless operation. I'd like to be able to run 
privileged commands when a user logins or logs out:


- on login, nfs mount the user's home directory (ok, not critical, I can 
mount /home)
- on logout a system reboot to clean up any temporary files left from 
the session.


Is this possible, without messing arround with sudo or adding users to 
wheel or operator groups?


Thanks, Erik

--
Erik Nørgaard
Ph: +34.666334818/+34.915211157  http://www.locolomo.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Howto run privileged commands on login/logout

2010-02-06 Thread Rob Farmer
On Sat, Feb 6, 2010 at 4:55 PM, Erik Norgaard norga...@locolomo.org wrote:
 Hi:

 I'm playing around with diskless operation. I'd like to be able to run
 privileged commands when a user logins or logs out:

 - on login, nfs mount the user's home directory (ok, not critical, I can
 mount /home)
 - on logout a system reboot to clean up any temporary files left from the
 session.

Not sure if it would work or not but you could try setting
/etc/csh.logout setuid root (or whatever). However, IIRC, there are
security concerns with setuid scripts (I remember previous list
discussions about setuid shell scripts but don't remember what the
verdict was).

-- 
Rob Farmer


 Is this possible, without messing arround with sudo or adding users to wheel
 or operator groups?

 Thanks, Erik

 --
 Erik Nørgaard
 Ph: +34.666334818/+34.915211157                  http://www.locolomo.org
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Howto run privileged commands on login/logout

2010-02-06 Thread Pieter de Goeje
On Sunday 07 February 2010 01:55:02 Erik Norgaard wrote:
 I'm playing around with diskless operation. I'd like to be able to run
 privileged commands when a user logins or logs out:

 - on login, nfs mount the user's home directory (ok, not critical, I can
 mount /home)

This can be done using amd(8). Check out the example section in amd.conf(5).

 - on logout a system reboot to clean up any temporary files left from
 the session.

Not sure why you would want to reboot the entire system but simply 
doing chmod +s /sbin/shutdown should give all users access to the 
shutdown(8) command.


 Is this possible, without messing arround with sudo or adding users to
 wheel or operator groups?

--
Pieter de Goeje
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Howto run privileged commands on login/logout

2010-02-06 Thread perryh
Erik Norgaard norga...@locolomo.org wrote:
 I'm playing around with diskless operation. I'd like to be able
 to run privileged commands when a user logins or logs out:

 - on login, nfs mount the user's home directory (ok, not critical,
 I can mount /home)

Or, better yet, use an automounter.

 - on logout a system reboot to clean up any temporary files left
 from the session.

I'm not aware of any existing, simple method to handle this part.
It might not be all that difficult to hack something into getty(8)
or init(8).  Another possibility would be to clean /tmp and /var/tmp
in the .logout script, which should not require any special privs.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


FreeBSD commands... refcard

2009-09-11 Thread Matthias Apitz

Hello,

In some Linux mailing list of Cuba I'm subscribed to, I just stumbled
over this Debian GNU/Linux Reference Card: http://xinocat.com/refcard/
which is available in many languages. This would be very helpfull for my
wife which 'must' ( :-)) run FreeBSD on her laptop. Is there something
like this for FreeBSD, and even in Spanish? Thanks

matthias
-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
People who hate Microsoft Windows use Linux but people who love UNIX use 
FreeBSD.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD commands... refcard

2009-09-11 Thread Manolis Kiagias
Matthias Apitz wrote:
 Hello,

 In some Linux mailing list of Cuba I'm subscribed to, I just stumbled
 over this Debian GNU/Linux Reference Card: http://xinocat.com/refcard/
 which is available in many languages. This would be very helpfull for my
 wife which 'must' ( :-)) run FreeBSD on her laptop. Is there something
 like this for FreeBSD, and even in Spanish? Thanks

   matthias
   

It wouldn't be difficult to do something similar. Looking at the Greek
version of the debian card, most commands are basic ones with similar
function in FreeBSD. We could replace the apt-get section with commands
from the ports system and pkg_* and the /etc/init.d/ section with
/etc/rc.d and /usr/local/etc/rc.d.

I'll try to make up an  initial English version this weekend.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD commands... refcard

2009-09-11 Thread Matthias Apitz
El día Friday, September 11, 2009 a las 12:21:41PM +0300, Manolis Kiagias 
escribió:

 Matthias Apitz wrote:
  Hello,
 
  In some Linux mailing list of Cuba I'm subscribed to, I just stumbled
  over this Debian GNU/Linux Reference Card: http://xinocat.com/refcard/
  which is available in many languages. This would be very helpfull for my
  wife which 'must' ( :-)) run FreeBSD on her laptop. Is there something
  like this for FreeBSD, and even in Spanish? Thanks
 
  matthias

 
 It wouldn't be difficult to do something similar. Looking at the Greek
 version of the debian card, most commands are basic ones with similar
 function in FreeBSD. We could replace the apt-get section with commands
 from the ports system and pkg_* and the /etc/init.d/ section with
 /etc/rc.d and /usr/local/etc/rc.d.
 
 I'll try to make up an  initial English version this weekend.

That would be very fine; please, can you describe also what software from the
ports one must use for Of course, you may alter the reference card to
you needs and create a cusomised refcard. You need to apt-get install
the following packages first: docbook-xsl, pdfjam, pdftk, po4a, xmlroff,
poppler-utils, and xsltproc.

I'd be more than happy to make a Spanish and German translation of it.

matthias
-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
People who hate Microsoft Windows use Linux but people who love UNIX use 
FreeBSD.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD commands... refcard

2009-09-11 Thread James Seward
On Fri, Sep 11, 2009 at 8:30 AM, Matthias Apitz g...@unixarea.de wrote:
 In some Linux mailing list of Cuba I'm subscribed to, I just stumbled
 over this Debian GNU/Linux Reference Card: http://xinocat.com/refcard/
 which is available in many languages. This would be very helpfull for my
 wife which 'must' ( :-)) run FreeBSD on her laptop. Is there something
 like this for FreeBSD, and even in Spanish? Thanks

Not quite the same, but have a look at the Rosetta Stone for Unix:
http://bhami.com/rosetta.html

/JMS
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD commands... refcard

2009-09-11 Thread Al Plant

Matthias Apitz wrote:

Hello,

In some Linux mailing list of Cuba I'm subscribed to, I just stumbled
over this Debian GNU/Linux Reference Card: http://xinocat.com/refcard/
which is available in many languages. This would be very helpfull for my
wife which 'must' ( :-)) run FreeBSD on her laptop. Is there something
like this for FreeBSD, and even in Spanish? Thanks

matthias

###

Aloha Matthias,

I have one of the cards for Unix (Generic)

I have seen them in Drug (Pharmacia) Stores in several countries I have 
been to, Canada and Argentina for 2)  for all sorts of how to's. Not 
just computers. I have seen English and Spanish language.


The manufacturer of the UNIX one is Bar Charts of Boca Raton Fla,

www.quickstudycharts.com

ot www.barcharts.com

Happy coaching.

--

~Al Plant - Honolulu, Hawaii -  Phone:  808-284-2740
  + http://hawaiidakine.com + http://freebsdinfo.org +
  + http://aloha50.net   - Supporting - FreeBSD 6.* - 7.* - 8.* +
   email: n...@hdk5.net 
All that's really worth doing is what we do for others.- Lewis Carrol

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-08 Thread Jonathan McKeown
On Friday 06 February 2009 02:55, Chris Whitehouse wrote:

 I think you should be able to do it with a combination of -prune and
 -delete (or -exec rm -rf {} \; ) on a find command. Substitute your
 other commands for rm -rf in the -exec above.

 I would give you a working example except I can't figure out the syntax
 for -prune. Examples from google don't seem to work in (my) FreeBSD.

[skip to the end for a simple answer without the lengthy exposition]

find(1) can be confusing, especially if you think of the ``actions'' 
( -print, -exec and -delete plus their variants like -ls and -ok ) as 
something different from the ``tests'' ( -name and so on), or if you don't 
take account of the evaluation order.

A find expression comprises a number of what the manpage calls primaries, each 
of which evaluates as true or false. (It may also have a side-effect, 
like -print whose side-effect is to print the name). Primaries can be 
combined with -and (which is usually implied) or -or. Where -and and -or both 
occur, find will group the -anded primaries together before evaluation. 
Taking one of your examples below,

find . -print -or -prune -name dir1

this is grouped as

find . -print -or \( -prune -and -name dir1 \)

find will then evaluate the whole expression from left to right for each 
pathname in the tree it's looking at, stopping within each set of (implied) 
parentheses and within the overall expression as soon as it can determine 
truth or falsehood. (This is what's referred to in programming as 
short-circuiting in boolean expressions).

If primaries are linked by -and, find can stop at the first one that's false, 
knowing the expression is false; if they're linked by -or it can stop at the 
first one that's true, knowing the expression is true. Otherwise it has to 
evaluate the whole expression.

Before it does this, though, find checks for side-effects. If there isn't a 
side-effect anywhere in your expression, find will put brackets round the 
whole expression and a -print after it.

Looking at your examples:

 chr...@pcbsd% find .

(No expression). Find adds a -print, so this is the same as the next one:

 chr...@pcbsd% find . -print
 .
 ./test.mov
 ./test.mpg
 ./dir1
 ./dir1/file1
 ./dir1/file2
 ./file3

-print is always true so the expression is true for each name - they get 
printed as a side-effect.

 chr...@pcbsd% find . -print -o -prune dir1
 find: dir1: unknown option

-prune doesn't take an argument, so dir1 is a syntax error.

 chr...@pcbsd% find . -print -o -prune -name dir1

find evaluates the print, which prints each name as its side-effect. -print 
evaluates as true. Since it's in an -or, find can stop there, so it never 
sees the second expression ( -prune -and -name dir1: the -and is implicit).
 .
 ./test.mov
 ./test.mpg
 ./dir1
 ./dir1/file1
 ./dir1/file2
 ./file3

 chr...@pcbsd% find . -print -o -name dir1 -prune

Same again: find stops after the -print which is always true, and ignores 
the -name dir1 -and -prune.

 chr...@pcbsd% find . -name * -o -name dir1 -prune

None of these primaries has a side-effect, so find rewrites this internally as

find . \( -name * -or -name dir1 -prune \) -print

-name * is always true, so find can ignore everything after the -or up to 
the parenthesis. Because the first expression is true, and the parens are 
followed by (an implied) -and, find has to evaluate the -print, which is 
always true, so the whole expression is always true and it always prints the 
name as a side-effect.
 .
 ./test.mov
 ./test.mpg
 ./dir1
 ./dir1/file1
 ./dir1/file2
 ./file3

What you need is an expression with two outcomes: a -prune for some names and 
a -print for others. That tells you you need an -or, and the -print must come 
after it because it's always true. Before the -or, -prune is always true so 
you need some sort of testing primary before the -prune.

That gives you

find . -name dir1 -prune -or -print

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-08 Thread Chris Whitehouse

Jonathan McKeown wrote:

On Friday 06 February 2009 02:55, Chris Whitehouse wrote:

I think you should be able to do it with a combination of -prune and
-delete (or -exec rm -rf {} \; ) on a find command. Substitute your
other commands for rm -rf in the -exec above.

I would give you a working example except I can't figure out the syntax
for -prune. Examples from google don't seem to work in (my) FreeBSD.


[skip to the end for a simple answer without the lengthy exposition]

find(1) can be confusing, especially if you think of the ``actions'' 
( -print, -exec and -delete plus their variants like -ls and -ok ) as 
something different from the ``tests'' ( -name and so on), or if you don't 
take account of the evaluation order.


A find expression comprises a number of what the manpage calls primaries, each 
of which evaluates as true or false. (It may also have a side-effect, 
like -print whose side-effect is to print the name). Primaries can be 
combined with -and (which is usually implied) or -or. Where -and and -or both 
occur, find will group the -anded primaries together before evaluation. 
Taking one of your examples below,


find . -print -or -prune -name dir1

this is grouped as

find . -print -or \( -prune -and -name dir1 \)

find will then evaluate the whole expression from left to right for each 
pathname in the tree it's looking at, stopping within each set of (implied) 
parentheses and within the overall expression as soon as it can determine 
truth or falsehood. (This is what's referred to in programming as 
short-circuiting in boolean expressions).


If primaries are linked by -and, find can stop at the first one that's false, 
knowing the expression is false; if they're linked by -or it can stop at the 
first one that's true, knowing the expression is true. Otherwise it has to 
evaluate the whole expression.


Before it does this, though, find checks for side-effects. If there isn't a 
side-effect anywhere in your expression, find will put brackets round the 
whole expression and a -print after it.


Looking at your examples:


chr...@pcbsd% find .


(No expression). Find adds a -print, so this is the same as the next one:


chr...@pcbsd% find . -print
.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3


-print is always true so the expression is true for each name - they get 
printed as a side-effect.



chr...@pcbsd% find . -print -o -prune dir1
find: dir1: unknown option


-prune doesn't take an argument, so dir1 is a syntax error.


chr...@pcbsd% find . -print -o -prune -name dir1


find evaluates the print, which prints each name as its side-effect. -print 
evaluates as true. Since it's in an -or, find can stop there, so it never 
sees the second expression ( -prune -and -name dir1: the -and is implicit).

.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3



chr...@pcbsd% find . -print -o -name dir1 -prune


Same again: find stops after the -print which is always true, and ignores 
the -name dir1 -and -prune.



chr...@pcbsd% find . -name * -o -name dir1 -prune


None of these primaries has a side-effect, so find rewrites this internally as

find . \( -name * -or -name dir1 -prune \) -print

-name * is always true, so find can ignore everything after the -or up to 
the parenthesis. Because the first expression is true, and the parens are 
followed by (an implied) -and, find has to evaluate the -print, which is 
always true, so the whole expression is always true and it always prints the 
name as a side-effect.

.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3


What you need is an expression with two outcomes: a -prune for some names and 
a -print for others. That tells you you need an -or, and the -print must come 
after it because it's always true. Before the -or, -prune is always true so 
you need some sort of testing primary before the -prune.


That gives you

find . -name dir1 -prune -or -print

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Thank you for this excellent answer! Now reading the man page begins to 
make sense.


Chris
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-05 Thread Chris Whitehouse

Jaime wrote:

On Wed, Feb 4, 2009 at 9:35 AM, t-u-t marshc...@gmail.com wrote:
if i have say one (or even two) single file/directories among many others,
and i want to perform any said function like cp, mv, rm, etc.. , to all
other files except that one or two, is there a way to do that in a single
command?
e.g
rm -r * {-except foo1 foo15}


I think you should be able to do it with a combination of -prune and 
-delete (or -exec rm -rf {} \; ) on a find command. Substitute your 
other commands for rm -rf in the -exec above.


I would give you a working example except I can't figure out the syntax 
for -prune. Examples from google don't seem to work in (my) FreeBSD.


chr...@pcbsd% find .
.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3
chr...@pcbsd% find . -print
.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3
chr...@pcbsd% find . -print -o -prune dir1
find: dir1: unknown option
chr...@pcbsd% find . -print -o -prune -name dir1
.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3
chr...@pcbsd% find . -print -o -name dir1 -prune
.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3
chr...@pcbsd% find . -o -name dir1 -prune
find: -o: no expression before -o
chr...@pcbsd% find . -name * -o -name dir1 -prune
.
./test.mov
./test.mpg
./dir1
./dir1/file1
./dir1/file2
./file3
chr...@pcbsd%

(Please don't tell me to read the man page, I have several times. Even 
Aeleen Frisch says it is impenetrable :P)


Chris
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-05 Thread Paul Procacci

Chris Whitehouse wrote:

Jaime wrote:

On Wed, Feb 4, 2009 at 9:35 AM, t-u-t marshc...@gmail.com wrote:
if i have say one (or even two) single file/directories among many 
others,

and i want to perform any said function like cp, mv, rm, etc.. , to all
other files except that one or two, is there a way to do that in a 
single

command?
e.g
rm -r * {-except foo1 foo15}


I think you should be able to do it with a combination of -prune and 
-delete (or -exec rm -rf {} \; ) on a find command. Substitute your 
other commands for rm -rf in the -exec above.


I would give you a working example except I can't figure out the 
syntax for -prune. Examples from google don't seem to work in (my) 
FreeBSD.


chr...@pcbsd% find .
..
../test.mov
../test.mpg
../dir1
../dir1/file1
../dir1/file2
../file3
chr...@pcbsd% find . -print
..
../test.mov
../test.mpg
../dir1
../dir1/file1
../dir1/file2
../file3
chr...@pcbsd% find . -print -o -prune dir1
find: dir1: unknown option
chr...@pcbsd% find . -print -o -prune -name dir1
..
../test.mov
../test.mpg
../dir1
../dir1/file1
../dir1/file2
../file3
chr...@pcbsd% find . -print -o -name dir1 -prune
..
../test.mov
../test.mpg
../dir1
../dir1/file1
../dir1/file2
../file3
chr...@pcbsd% find . -o -name dir1 -prune
find: -o: no expression before -o
chr...@pcbsd% find . -name * -o -name dir1 -prune
..
../test.mov
../test.mpg
../dir1
../dir1/file1
../dir1/file2
../file3
chr...@pcbsd%

(Please don't tell me to read the man page, I have several times. Even 
Aeleen Frisch says it is impenetrable :P)


Chris
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org


find . \! -name blah -a \! -name blah2 -delete

no?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


shell commands - exclusion

2009-02-04 Thread t-u-t
hi, i don't know if this is a freak question, but i was looking around to
see if this is possible, and what the convention would be.

if i have say one (or even two) single file/directories among many others,
and i want to perform any said function like cp, mv, rm, etc.. , to all
other files except that one or two, is there a way to do that in a single
command?
e.g
rm -r * {-except foo1 foo15}

and if there is, could the same be applied to other similar batch (?)
operations, like pkg_delete -f * { except firefox3 wine thunderbird }
etc..

i'm a bit new to the shell (took me a while to figure out *ls* and *ls |
more*), but i can't find anything from google cuz i don't know what this
would be called in the first place.

otherwise is it better to protect them with chflags or other trickery?

thanks in advance
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-04 Thread Lars Eighner

On Wed, 4 Feb 2009, t-u-t wrote:


hi, i don't know if this is a freak question, but i was looking around to
see if this is possible, and what the convention would be.

if i have say one (or even two) single file/directories among many others,
and i want to perform any said function like cp, mv, rm, etc.. , to all
other files except that one or two, is there a way to do that in a single
command?
e.g
rm -r * {-except foo1 foo15}


In general this is not possible.  A few commands have exclusion options, but
not many.  Some shells have ways of managing glob exclusion (it's the shell
that expands wildcard patterns).  Setting GLOBIGNORE works in BASH, whether
something similar works in others, you will have to investigate yourself. 
But that isn't one line as you have to set GLOBIGNORE.  BASH also has an

extended pattern matching option which includes negation, so you might want
to look into that.


and if there is, could the same be applied to other similar batch (?)
operations, like pkg_delete -f * { except firefox3 wine thunderbird }
etc..


pkg_delete can take regular expression arguments (see -x).  Perhaps you
can devise one that will do the trick.  Beware, however: it can take
multiple regular expressions and deletes package which match ANY (not all)
of them.


i'm a bit new to the shell (took me a while to figure out *ls* and *ls |
more*), but i can't find anything from google cuz i don't know what this
would be called in the first place.


Shell globbing is the operation by which the shell expands wildcards and
finds matches.  What you want to do exclude things from shell globbing.


otherwise is it better to protect them with chflags or other trickery?


watch out anything involving recursion --- things can happen that you don't
expect unless you really know what you are doing.

--
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-04 Thread Dan Nelson
In the last episode (Feb 04), t-u-t said:
 hi, i don't know if this is a freak question, but i was looking around to
 see if this is possible, and what the convention would be.
 
 if i have say one (or even two) single file/directories among many others,
 and i want to perform any said function like cp, mv, rm, etc..  , to all
 other files except that one or two, is there a way to do that in a single
 command?
 e.g
 rm -r * {-except foo1 foo15}

zsh has the ^ and ~ glob metacharacters that are enabled with you enable
EXTENDED_GLOB:

   ^x (Requires EXTENDED_GLOB to be set.)  Matches anything except
  the pattern x.  This has a higher precedence than `/', so
  `^foo/bar' will search directories in `.' except `./foo' for a
  file named `bar'.

   x~y(Requires EXTENDED_GLOB to be set.)  Match anything that
  matches the pattern x but does not match y.  This has lower
  precedence than any operator except `|', so `*/*~foo/bar' will
  search for all files in all directories in `.' and then
  exclude `foo/bar' if there was such a match.  Multiple
  patterns can be excluded by `foo~bar~baz'.  In the exclusion
  pattern (y), `/' and `.' are not treated specially the way
  they usually are in globbing.
 
 and if there is, could the same be applied to other similar batch (?)
 operations, like pkg_delete -f * { except firefox3 wine thunderbird }
 etc..

That wildcard is expanded internally by pkg_delete using the C fnmatch()
function, which just does simple *?[] shell pattern matching.
 
 i'm a bit new to the shell (took me a while to figure out *ls* and *ls |
 more*), but i can't find anything from google cuz i don't know what this
 would be called in the first place.
 
 otherwise is it better to protect them with chflags or other trickery?

One workaround is to temporarily move the files you don't want to process
into another directory, then move them back when you're done.

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-04 Thread t-u-t
On Wed, Feb 4, 2009 at 4:26 PM, Lars Eighner luvbeas...@larseighner.comwrote:


 In general this is not possible.  A few commands have exclusion options,
 but
 not many.  Some shells have ways of managing glob exclusion (it's the shell
 that expands wildcard patterns).  Setting GLOBIGNORE works in BASH, whether
 something similar works in others, you will have to investigate yourself.
 But that isn't one line as you have to set GLOBIGNORE.  BASH also has an
 extended pattern matching option which includes negation, so you might want
 to look into that.
 pkg_delete can take regular expression arguments (see -x).  Perhaps you
 can devise one that will do the trick.  Beware, however: it can take
 multiple regular expressions and deletes package which match ANY (not all)
 of them.
 Shell globbing is the operation by which the shell expands wildcards and
 finds matches.  What you want to do exclude things from shell globbing.
 watch out anything involving recursion --- things can happen that you don't
 expect unless you really know what you are doing.


thank you,
i can keep to regular painstaking methods for now, but would like to get the
hang of it in future;. knowing what i'm looking for now is a big step for
me.
thanks again
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-04 Thread t-u-t
On Wed, Feb 4, 2009 at 4:48 PM, Dan Nelson dnel...@allantgroup.com wrote:

 zsh has the ^ and ~ glob metacharacters that are enabled with you enable
 EXTENDED_GLOB:

   ^x (Requires EXTENDED_GLOB to be set.)  Matches anything except
  the pattern x.  This has a higher precedence than `/', so
  `^foo/bar' will search directories in `.' except `./foo' for a
  file named `bar'.

   x~y(Requires EXTENDED_GLOB to be set.)  Match anything that
  matches the pattern x but does not match y.  This has lower
  precedence than any operator except `|', so `*/*~foo/bar' will
  search for all files in all directories in `.' and then
  exclude `foo/bar' if there was such a match.  Multiple
  patterns can be excluded by `foo~bar~baz'.  In the exclusion
  pattern (y), `/' and `.' are not treated specially the way
  they usually are in globbing.

  and if there is, could the same be applied to other similar batch (?)
  operations, like pkg_delete -f * { except firefox3 wine thunderbird }
  etc..

 That wildcard is expanded internally by pkg_delete using the C fnmatch()
 function, which just does simple *?[] shell pattern matching.

  i'm a bit new to the shell (took me a while to figure out *ls* and *ls |
  more*), but i can't find anything from google cuz i don't know what this
  would be called in the first place.
 
  otherwise is it better to protect them with chflags or other trickery?

 One workaround is to temporarily move the files you don't want to process
 into another directory, then move them back when you're done.

 --

thank you,
i am interested in knowing how to do this stuff in general for simple
operations, since like this workaround would work fine with file
operations, but not for pkg_delete and other commands i can't think of right
now. I was just wondering if there was a commonly used/known method or
*switch* i could look into.

however, form this post i get the impression that it is better( and
worthwhile) to learn to do some proper scripting. say, prepare a list in a
file, then pass each one to the command instead of *.

cheers
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-04 Thread Roland Smith
On Wed, Feb 04, 2009 at 03:35:52PM +0100, t-u-t wrote:
 hi, i don't know if this is a freak question, but i was looking around to
 see if this is possible, and what the convention would be.
 
 if i have say one (or even two) single file/directories among many others,
 and i want to perform any said function like cp, mv, rm, etc.. , to all
 other files except that one or two, is there a way to do that in a single
 command?
 e.g
 rm -r * {-except foo1 foo15}

The easiest way would be to move the few files/directories you don't
want to include in your command out of the way first. :-)

 and if there is, could the same be applied to other similar batch (?)
 operations, like pkg_delete -f * { except firefox3 wine thunderbird }
 etc..
I don't think so.

If the couple of files you don't want to rm/whatever you could try using
the find(1) command to get all the other files. The find command is a
very good tool to know.

 i'm a bit new to the shell (took me a while to figure out *ls* and *ls |
 more*), but i can't find anything from google cuz i don't know what this
 would be called in the first place.

Maybe a stupid question, but do you know how to read manual pages?
E.g. for 'find', just enter the command 'man find' in your shell.

 otherwise is it better to protect them with chflags or other trickery?

That would be my other suggestion.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpBb0RvKa0Bk.pgp
Description: PGP signature


Re: shell commands - exclusion

2009-02-04 Thread Jaime
On Wed, Feb 4, 2009 at 9:35 AM, t-u-t marshc...@gmail.com wrote:
 if i have say one (or even two) single file/directories among many others,
 and i want to perform any said function like cp, mv, rm, etc.. , to all
 other files except that one or two, is there a way to do that in a single
 command?
 e.g
 rm -r * {-except foo1 foo15}

I'm just shooting in the dark here, but what about this?

ls | grep -v foo1 | grep -v foo15 | xargs rm -rf

Remember the Unix pipe and the grep and xargs commands.  It can
solve a lot of things by stringing together a lot of smaller commands.
 I think that this might be one of those situations.

Good luck,
Jaime


-- 
To affect the quality of the day, that is the highest of arts.  --
Henry David Thoreau

Tone of voice in email is misunderstood 50% of the time.
Source:  http://www.howtoweb.com/cgi-bin/insider.pl?zone=214061
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell commands - exclusion

2009-02-04 Thread William Gordon Rutherdale

Lars Eighner wrote:

On Wed, 4 Feb 2009, t-u-t wrote:

hi, i don't know if this is a freak question, but i was looking 
around to

see if this is possible, and what the convention would be.

if i have say one (or even two) single file/directories among many 
others,

and i want to perform any said function like cp, mv, rm, etc.. , to all
other files except that one or two, is there a way to do that in a 
single

command?
e.g
rm -r * {-except foo1 foo15}


In general this is not possible. . . .
Oh yes it is, it is very easy.  I've done things like this in unix 
environments for years.  I also apply it to tar commands all the time.


All you have to do is this:

$ ls rm.in
$ vi rm.in
  . . . edit out all the files you don't want to erase . . .
$ rm `cat rm.in`

-Will


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


The results of your email commands

2008-12-24 Thread express-bounces
The results of your email command are provided below. Attached is your
original message.

- Results:
questi...@freebsd.org is not a member of the Express mailing list

- Unprocessed:
Greater tool is easy to get  T42
Make your love locomotive enter her tunnel on a full speed.
http://docs.google.com/View?id=dgrdn7xj_1g97vjxfk
AWDJBW3LLL
Y9J7AS

- Done.

---BeginMessage---


Make your love locomotive enter her tunnel on a full speed.



http://docs.google.com/View?id=dgrdn7xj_1g97vjxfk


AWDJBW3LLL
Y9J7AS




---End Message---
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

The results of your email commands

2008-12-24 Thread express-bounces
The results of your email command are provided below. Attached is your
original message.


- Unprocessed:
http://docs.google.com/View?id=dgrdn7xj_1g97vjxfk
AWDJBW3LLL
Y9J7AS

- Done.

---BeginMessage---


Make your love locomotive enter her tunnel on a full speed.



http://docs.google.com/View?id=dgrdn7xj_1g97vjxfk


AWDJBW3LLL
Y9J7AS




---End Message---
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

sudo multiple commands at once without shell script

2008-10-25 Thread Kelly Jones
How do I run multiple sudo commands at once? This fails because the
semicolon ends the whole sudo command:

 sudo whoami; whoami
root
user

This confuses tcsh:

monica:~ sudo ( whoami ; whoami )
Badly placed ()'s.

I could obviously write a shell script or something or do:

 sudo whoami; sudo whoami

but is there a better way?

-- 
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: sudo multiple commands at once without shell script

2008-10-25 Thread perryh
 How do I run multiple sudo commands at once? This fails
 because the semicolon ends the whole sudo command:

  sudo whoami; whoami
 root
 user

 This confuses tcsh:

 monica:~ sudo ( whoami ; whoami )
 Badly placed ()'s.

Supposing sudo spawns a shell, something like

  ~ sudo whoami \; whoami

or

  ~ sudo whoami; whoami

should work.  If not, maybe try explicitly running a shell:

  ~ sudo sh -c whoami; whoami
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: sudo multiple commands at once without shell script

2008-10-25 Thread Tom Marchand

This works for me:

sudo sh -c whoami;whoami



On Oct 25, 2008, at 9:11 PM, Kelly Jones wrote:


How do I run multiple sudo commands at once? This fails because the
semicolon ends the whole sudo command:


sudo whoami; whoami

root
user

This confuses tcsh:

monica:~ sudo ( whoami ; whoami )
Badly placed ()'s.

I could obviously write a shell script or something or do:


sudo whoami; sudo whoami


but is there a better way?

--  
We're just a Bunch Of Regular Guys, a collective group that's trying

to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED] 



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


Recommendations for BSD Unix Toolbox: 1000+ Commands for FreeBSD BSD Books

2008-04-28 Thread loony

What are folks recommendations for the updated edition of BSD UNIX Toolbox: 
1000+ Commands for FreeBSD, OpenBSD and NetBSD (Paperback)by Christopher Negus 
(Author), Francois Caen (Author)?

Overall, Absolute FreeBSD boosted my confidence/competence but as my  only  
printed  Unix/Linux/BSD  resource although it is not the be one and end all  
resource to FreeBSD as I was hoping for, particularly when it comes to slightly 
more advanced topics as building a production LAMP server.  I have the budget 
for another book.

I don't have access to a print version so I can really check it out before I 
buy.  Has anyone found BSD UNIX useful, more than useless, or redundant?  Is it 
organized and indexed well?  Is a good read on the toilet or only when when 
your working on a box?  Hasn't some other sys admin documented their commands 
really well and shared them?  This recommendation would be for a FreeBSD novice 
user.  If they didn't know how to script and had a choice between BSD UNIX 
Toolbox and a book about how to script, what would they be better off getting?

On that note, does anyone have recommendations for a freebsd orientated 
beginners guide to scripting and using scripts to manage a freebsd box and 
common systems/services/daemons?

loonybomber


May the admins live long and prosper.





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


Re: Recommendations for BSD Unix Toolbox: 1000+ Commands for FreeBSD BSD Books

2008-04-28 Thread Roland Smith
On Mon, Apr 28, 2008 at 02:10:45PM -0700, loony wrote:
 
 Overall, Absolute FreeBSD boosted my confidence/competence but as my
 only  printed  Unix/Linux/BSD  resource although it is not the be one
 and end all  resource to FreeBSD as I was hoping for, particularly
 when it comes to slightly more advanced topics as building a
 production LAMP server.  I have the budget for another book. 

Configuring a ?AMP server is largely not really OS specific (apart from
things like firewalling). The AMP part should work on all UNIX-like
systems. Of course FreeBSD has ports, which makes installation of the
software easier.

Some searching on the internet is certain to give you lots of tutorials.

 This recommendation would be for a FreeBSD novice user.  If they
 didn't know how to script and had a choice between BSD UNIX Toolbox
 and a book about how to script, what would they be better off getting?

Depends on the persons other exerience. I switched to FreeBSD after
having used Slackware Linux for several years. With the Handbook and the
manual pages, I fealt at home straight away.

For novices, I would teach them system administration first, and
scripting later.

 On that note, does anyone have recommendations for a freebsd
 orientated beginners guide to scripting and using scripts to manage a
 freebsd box and common systems/services/daemons?

There is a lot of usefull documentation included with FreeBSD, starting
with the Handbook and FAQ. Look in /usr/share/doc/en_US.ISO8859-1/books

Daemons belonging to the base system or available via ports come with a
control script in (/usr/local)/etc/rc.d. There is no need to write your
own, unless you want to contribute a new port, which is not really a job
for a novice. However, one can learn a lot by studying the already available
scripts and the infrastructure that supports them. 

I've also found the Advanced Bash-Scripting Guide
[http://tldp.org/LDP/abs/html/] usefull, although one has to be carefull
of bash-specific features not supported by FreeBSD's /bin/sh.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpNEHzWVynWS.pgp
Description: PGP signature


Re: Recommendations for BSD Unix Toolbox: 1000+ Commands for FreeBSD BSD Books

2008-04-28 Thread Jon Radel
loony wrote:
 
 What are folks recommendations for the updated edition of BSD UNIX Toolbox: 
 1000+ Commands for FreeBSD, OpenBSD and NetBSD (Paperback)by Christopher 
 Negus 
 (Author), Francois Caen (Author)?

Amazon.com started shipping pre-ordered copies only today, so I can't
imagine too many people have had a chance to form in-depth impressions
yet.  I'll try to say more after I actually have browsed my copy.  :-)

For the moment, I will strongly second Roland Smith's reminder that ?AMP
 is largely OS independent so long as you use a *n?x that
Apache/MySQL/etc. are well supported under.  You may well do better to
find a Use Apache to build a web site or (language of your choice)
with (database of your choice) book that suits your development
philosophy.

--Jon Radel


smime.p7s
Description: S/MIME Cryptographic Signature


Sudo Commands on New 6.2 System Cause Last Login Message.

2008-04-03 Thread Martin McCormick
I noticed that every sudo command I issue is accompanied
by a Last login message.

25testokcns root $ls .hushlogin
ls: .hushlogin: No such file or directory
26testokcns root $sudo touch .hushlogin
Last login: Thu Apr  3 11:38:24 from testokcns.osuokc
27testokcns root $sudo date
Last login: Thu Apr  3 11:41:10 from testokcns.osuokc
Thu Apr  3 11:41:17 CDT 2008

I was trying to see if a .hushlogin file in /root might snuff
out the messages, but it had no effect.

The commands always work but I would rather not get that message
each time. Am I missing something obvious?

Thanks.


Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Network Operations Group
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Sudo Commands on New 6.2 System Cause Last Login Message.

2008-04-03 Thread Steven Friedrich
On Thursday 03 April 2008 01:06:37 pm Martin McCormick wrote:
   I noticed that every sudo command I issue is accompanied
 by a Last login message.

 25testokcns root $ls .hushlogin
 ls: .hushlogin: No such file or directory
 26testokcns root $sudo touch .hushlogin
 Last login: Thu Apr  3 11:38:24 from testokcns.osuokc
 27testokcns root $sudo date
 Last login: Thu Apr  3 11:41:10 from testokcns.osuokc
 Thu Apr  3 11:41:17 CDT 2008

 I was trying to see if a .hushlogin file in /root might snuff
 out the messages, but it had no effect.

 The commands always work but I would rather not get that message
 each time. Am I missing something obvious?

   Thanks.


 Martin McCormick WB5AGZ  Stillwater, OK
 Systems Engineer
 OSU Information Technology Department Network Operations Group
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 [EMAIL PROTECTED]

Well, it IS odd that you're using sudo when logged in as root 8o)
Did you edit /usr/local/etc/sudoers ?
I tried you're commands here and I don't get the Last login message.
I'm currently running 7.0-RELEASE, but this machine was originally installed 
way back during 5.x days and I installed sudo way back then.
In sudoers, do you have rootALL=(ALL) ALL ?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Sudo Commands on New 6.2 System Cause Last Login Message.

2008-04-03 Thread Martin McCormick
Steven Friedrich writes:
 26testokcns root $sudo touch .hushlogin
Well, it IS odd that you're using sudo when logged in as root 8o)

I was cd'd to the /root directory, but was logged in as
me. It kind of got me there for a second, but notice the $ in
the prompt.

Interestingly enough, sudo -v doesn't cause this
message.

Did you edit /usr/local/etc/sudoers ?
I tried you're commands here and I don't get the Last login message.

I am not getting it on most other FreeBSD systems except
the newest 2 systems I just finished updating in the last couple
of days.

In sudoers, do you have rootALL=(ALL) ALL ?

Yes. That's where I added all of the users who can sudo. I even
copied it out of another sudoers file so as not to miss anybody.

The FreeBSD version I am using is
FreeBSD 6.2-RELEASE-p11

Interestingly, the system I am on right this minute is the same
version and does not exhibit this behavior.

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


Re: Sudo Commands on New 6.2 System Cause Last Login Message.

2008-04-03 Thread David Robillard
 The commands always work but I would rather not get that message
 each time. Am I missing something obvious?

A quick google search will show you that it's the
${LOCALBASE}/etc/pam.d/sudo file which is the root of your problem.
It's pam_lastlog(8) which makes the message.  If you don't need it,
comment out the...

session include system

... line in ${LOCALBASE}/etc/pam.d/sudo to get rid of this behavior.

Cheers,

David
-- 
David Robillard
UNIX systems administrator  Oracle DBA
CISSP, RHCE  Sun Certified Security Administrator
Montreal: +1 514 966 0122
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Sudo Commands on New 6.2 System Cause Last Login Message.

2008-04-03 Thread Tom McLaughlin

On Thu, 2008-04-03 at 12:06 -0500, Martin McCormick wrote:
   I noticed that every sudo command I issue is accompanied
 by a Last login message.
 
 25testokcns root $ls .hushlogin
 ls: .hushlogin: No such file or directory
 26testokcns root $sudo touch .hushlogin
 Last login: Thu Apr  3 11:38:24 from testokcns.osuokc
 27testokcns root $sudo date
 Last login: Thu Apr  3 11:41:10 from testokcns.osuokc
 Thu Apr  3 11:41:17 CDT 2008
 
 I was trying to see if a .hushlogin file in /root might snuff
 out the messages, but it had no effect.
 
 The commands always work but I would rather not get that message
 each time. Am I missing something obvious?
 
   Thanks.

Make sure you have the latest version of the sudo port.  This issue
where pam_lastlog was being called because the system pam.d file was
included in the session section of sudo's pam file was fixed.

tom

-- 
| tmclaugh at sdf.lonestar.org tmclaugh at FreeBSD.org |
| FreeBSD   http://www.FreeBSD.org |

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


Re: How to use cut or awk commands into sed command ?

2007-12-13 Thread Frank Shute
On Thu, Dec 13, 2007 at 09:35:29AM +0200, Halid Faith wrote:

 Let me try to explain
 I have a file called A which contains variable values as below;
 file1, abc12
 foot1, cba11
 boby, def123
 ...
 
 Also I have another file called B which contains partly valuable values as
 following;
 ### file of A begin
 Server valuable1
 Client valuable2
  the file end
 
 I have to assign the first column valuables in A to valuable1 in B and
 assign second column valuable1 in A to valuable2 in B.
 Finally I should see as following in a file called C
 Server file1
 Client abc12
 
 Server foot1
 Client cba11
 
 Server boby
 Client def123
 
 How can I do that ? Could you give me a script ?
 
 Also does it possible to define two or more variable in for loop as below
  for  i in `cat file1` a  in `cat file2` ;
 do
 sed -e s/oldstring1/$i/ -e s/oldstring2/$a/
 done
 
 Thanks

Have a look at join(1). You should be able to knock something together
with join and sed.

Personally, I'd use perl for something like this. (Not much help if
you don't know perl).

-- 

 Frank 


 Contact info: http://www.esperance-linux.co.uk/misc/contact.html 

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


Re: How to use cut or awk commands into sed command ?

2007-12-13 Thread Giorgos Keramidas
On 2007-12-13 09:35, Halid Faith [EMAIL PROTECTED] wrote:
 Let me try to explain
 I have a file called A which contains variable values as below;
 file1, abc12
 foot1, cba11
 boby, def123
 ...
 
 Also I have another file called B which contains partly valuable values as
 following;
 ### file of A begin
 Server valuable1
 Client valuable2
  the file end
 
 I have to assign the first column valuables in A to valuable1 in B and
 assign second column valuable1 in A to valuable2 in B.

 Finally I should see as following in a file called C
 Server file1
 Client abc12
 
 Server foot1
 Client cba11
 
 Server boby
 Client def123

 How can I do that ? Could you give me a script ?

Look carefully at the second input file:

Server valuable1
Client valuable2

Now look *very* carefully at the output you want:

Server file1
Client abc12

Server foot1
Client cba11

Server boby
Client def123

Can you imagine a *loop* which reads the input file and creates the
second?  In `pseudo-code' this would be something like:

for each pair of (server, client) from `file1':
for each line in `file2':
substitute `server' and `client' in `line'
print resulting line
print an empty line

That shouldn't be *too* hard to write in a shell script.  Now that you
have the outline, see if you have better luck.

- Giorgos

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


How to use cut or awk commands into sed command ?

2007-12-12 Thread Halid Faith
I have a file named file1 which contains some values.
I want to replace some strings into it, so I use sed command but I get an error.

sed s#oldstring#`cut -d, -f3 file2`#  file1

sed: 1: s/yenidomain2/f0b2875d- ...: unterminated substitute in regular 
expression

also I get an error with awk command into sed;
sed s#oldstring#`awk -F, '{print$3}' file2`#file1
sed: 1: s#yenidomain2#f0b2875d- ...: unterminated substitute in regular 
expression




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


Re: How to use cut or awk commands into sed command ?

2007-12-12 Thread Tino Engel

Halid Faith schrieb:

I have a file named file1 which contains some values.
I want to replace some strings into it, so I use sed command but I get an error.

sed s#oldstring#`cut -d, -f3 file2`#  file1

sed: 1: s/yenidomain2/f0b2875d- ...: unterminated substitute in regular 
expression

also I get an error with awk command into sed;
sed s#oldstring#`awk -F, '{print$3}' file2`#file1
sed: 1: s#yenidomain2#f0b2875d- ...: unterminated substitute in regular 
expression
  

Sure you know what you are doing?
You are giving probably various linefeeds to your substitution (assuming 
file2 has more than one line).
E.G. 'awk ... file2' produces as many lines as there are in file2. But 
the substitution in sed has to be a string-like expression with no line 
feeds.


There for the unterminated substitution error.

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


Re: How to use cut or awk commands into sed command ?

2007-12-12 Thread Bill Campbell
On Wed, Dec 12, 2007, Halid Faith wrote:
I have a file named file1 which contains some values.
I want to replace some strings into it, so I use sed command but I get an 
error.

sed s#oldstring#`cut -d, -f3 file2`#  file1

sed: 1: s/yenidomain2/f0b2875d- ...: unterminated substitute in regular 
expression

also I get an error with awk command into sed;
sed s#oldstring#`awk -F, '{print$3}' file2`#file1
sed: 1: s#yenidomain2#f0b2875d- ...: unterminated substitute in regular 
expression

The ``cut -d...` may well be biting you with multiple lines or
extra line feeds.  You might see the problem by prefixing your
command with ``echo'' to see what it's actually doing.

echo sed s#oldstring#`cut -d, -f3 file2`#  file1

I usually do more complex substitutions with short python or perl
scripts as (a) they use a common regular expression syntax, and
(b) I find the code cleaner (at least the python :-)

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

Scientists are explorers. Philosophers are tourists. -- Richard Feynman
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to use cut or awk commands into sed command ?

2007-12-12 Thread Giorgos Keramidas
On 2007-12-12 23:19, Halid Faith [EMAIL PROTECTED] wrote:
 I have a file named file1 which contains some values.
 I want to replace some strings into it, so I use sed command but I get an 
 error.

 sed s#oldstring#`cut -d, -f3 file2`#  file1
 sed: 1: s/yenidomain2/f0b2875d- ...: unterminated substitute in regular 
 expression

That's not enough information to help you in a meaningful manner.

* What does `file2' have to do with the replacement strings, and why do
  you use it?

* What are the contents of both files?

* What do you want to replace, and what should it be replaced with?

 also I get an error with awk command into sed;
 sed s#oldstring#`awk -F, '{print$3}' file2`#file1
 sed: 1: s#yenidomain2#f0b2875d- ...: unterminated substitute in regular 
 expression

That's not very different from the cut-based command.

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


Re: How to use cut or awk commands into sed command ?

2007-12-12 Thread Halid Faith
Let me try to explain
I have a file called A which contains variable values as below;
file1, abc12
foot1, cba11
boby, def123
...

Also I have another file called B which contains partly valuable values as
following;
### file of A begin
Server valuable1
Client valuable2
 the file end

I have to assign the first column valuables in A to valuable1 in B and
assign second column valuable1 in A to valuable2 in B.
Finally I should see as following in a file called C
Server file1
Client abc12

Server foot1
Client cba11

Server boby
Client def123

How can I do that ? Could you give me a script ?

Also does it possible to define two or more variable in for loop as below
 for  i in `cat file1` a  in `cat file2` ;
do
sed -e s/oldstring1/$i/ -e s/oldstring2/$a/
done

Thanks

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


Why crontab is not able to run some commands ?

2007-05-11 Thread Halid Faith

I have a script. As I am a root user,  I can run it without a problem. I
added that script to crontab in order to run as automatic.
I entered in /etc/crontab and put down as below;
*/20 *   *   *   *   root/etc/scriptfile

Despite root user, the crontab could not run above file. But I can run the
same script in command line interface.
I am sure tha the crontab daemon is running. Also I can see the crontab try
to run that script in /var/log/cron.
/usr/sbin/cron[98727]: (root) CMD (/etc/scriptfile)
When I am a different user, I couldn't run the script and I got access
denied
What is the problem ?

Thanks

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


Re: Why crontab is not able to run some commands ?

2007-05-11 Thread Duane Hill

On Fri, 11 May 2007, Halid Faith wrote:



I have a script. As I am a root user,  I can run it without a problem. I
added that script to crontab in order to run as automatic.
I entered in /etc/crontab and put down as below;
*/20 *   *   *   *   root/etc/scriptfile

Despite root user, the crontab could not run above file. But I can run the
same script in command line interface.
I am sure tha the crontab daemon is running. Also I can see the crontab try
to run that script in /var/log/cron.
/usr/sbin/cron[98727]: (root) CMD (/etc/scriptfile)
When I am a different user, I couldn't run the script and I got access
denied
What is the problem ?


Were you either logged in as root or su'd to root when you ran the script? 
If so, why not just install the cron as root by:


% crontab -u root -e

The only change to your cron line you would have to make is to drop the 
username 'root'. So it would look like:


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


Re: Why crontab is not able to run some commands ?

2007-05-11 Thread Paul Schmehl
--On Friday, May 11, 2007 21:53:24 +0300 Halid Faith [EMAIL PROTECTED] 
wrote:




I have a script. As I am a root user,  I can run it without a problem. I
added that script to crontab in order to run as automatic.
I entered in /etc/crontab and put down as below;
*/20 *   *   *   *   root/etc/scriptfile


Try running this from the commandline:

root /etc/scriptfile

Bet it doesn't work.  :-)

Then try running this in your cron job:
/bin/sh /etc/scriptfile

Bet it does work.  :-)

--
Paul Schmehl ([EMAIL PROTECTED])
Senior Information Security Analyst
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/


Re: Why crontab is not able to run some commands ?

2007-05-11 Thread Duane Hill

On Fri, 11 May 2007, Paul Schmehl wrote:



Then try running this in your cron job:
/bin/sh /etc/scriptfile

Bet it does work.  :-)


Yes, but if the OP has:

#!/bin/sh

as the first line, the file owned by root and the executable flag for user 
set, shouldn't it execute from cron as just:


/etc/scriptfile

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


Re: Why crontab is not able to run some commands ?

2007-05-11 Thread Paul Schmehl
--On Friday, May 11, 2007 19:45:22 + Duane Hill 
[EMAIL PROTECTED] wrote:



On Fri, 11 May 2007, Paul Schmehl wrote:



Then try running this in your cron job:
/bin/sh /etc/scriptfile

Bet it does work.  :-)


Yes, but if the OP has:

# !/bin/sh

as the first line, the file owned by root and the executable flag for
user set, shouldn't it execute from cron as just:

/etc/scriptfile

??

Yes, but I always like cron jobs to specifically call absolute path to the 
binary of choice.  That way someone couldn't substitute a different binary 
by altering the path and force a cron job to do something unexpected.


--
Paul Schmehl ([EMAIL PROTECTED])
Senior Information Security Analyst
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/


Re: Why crontab is not able to run some commands ?

2007-05-11 Thread James Anderson

On 5/11/07, Halid Faith [EMAIL PROTECTED] wrote:


I have a script. As I am a root user,  I can run it without a problem. I
added that script to crontab in order to run as automatic.
I entered in /etc/crontab and put down as below;
*/20 *   *   *   *   root/etc/scriptfile

Despite root user, the crontab could not run above file. But I can run the
same script in command line interface.


Which command are you using to run the script on the command line?
Are you just typing out /etc/scriptfile into the shell prompt, or are
you running sh /etc/scriptfile or running it via some other
interpreter?


I am sure tha the crontab daemon is running. Also I can see the crontab try
to run that script in /var/log/cron.
/usr/sbin/cron[98727]: (root) CMD (/etc/scriptfile)


Which indication do you have that cron ISN'T running the script?


When I am a different user, I couldn't run the script and I got access
denied
What is the problem ?


Which file permission does /etc/scriptfile have? (ls -l /etc/scriptfile)

Maybe the other user doesn't have read and/or execute permission?

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


Re: Why crontab is not able to run some commands ?

2007-05-11 Thread Duane Hill

On Fri, 11 May 2007, Paul Schmehl wrote:

--On Friday, May 11, 2007 19:45:22 + Duane Hill [EMAIL PROTECTED] 
wrote:



On Fri, 11 May 2007, Paul Schmehl wrote:



Then try running this in your cron job:
/bin/sh /etc/scriptfile

Bet it does work.  :-)


Yes, but if the OP has:

# !/bin/sh

as the first line, the file owned by root and the executable flag for
user set, shouldn't it execute from cron as just:

/etc/scriptfile

??

Yes, but I always like cron jobs to specifically call absolute path to the 
binary of choice.  That way someone couldn't substitute a different binary by 
altering the path and force a cron job to do something unexpected.


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


List of FreeBSD commands (was: Re: (no subject))

2007-03-15 Thread cpghost
On Thu, Mar 15, 2007 at 06:03:25AM +, neo neo wrote:
 i am new at FreeBSD .
 
 Where can i get FreeBSD commands list?

I assume that by 'command' you mean executable programs that are
part of the FreeBSD operating system, or programs that you add
later via packages or port...

1. Most commands are in /bin and /usr/bin.
2. Sysadmin (root) commands are in /sbin and /usr/sbin.
3. Commands that you add via the ports system usually end up
in /usr/local/bin and /usr/X11R6/bin

To get a list of a directory (folder in Windows-speak), just
call ls (which is itself in /bin; /bin/ls):

% ls /usr/bin

(or ls /usr/bin | more if the list is too long for one screen)

Commands usually (but not always) have a manual page avaiable, e.g.:

% man ls

Oh, and btw, welcome to FreeBSD. :-)

 thankz .
 
 ZAW HTET AUNG

Regards,
-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: ifstated check commands behavior

2007-03-15 Thread Alexandre Biancalana

On 3/14/07, Alexandre Biancalana [EMAIL PROTECTED] wrote:


Hi list,

  I'm trying to setup ifstated to check two links and if some go down, do
some actions like change pf rules and machine's route.

  My doubt is about the execution order/repetition of the states body of
ifstated.conf, in all configs that I tried just the last check is executed
always, follow and example:

ifstated.conf:
==
loglevel debug

ping1 = '( ping -q -c 1 -t 3 www.site1.com  /dev/null every 10 ) '
ping2 = '( ping -q -c 1 -t 3 www.site2.com  /dev/null every 10 ) '

state one {
if ! ( $ping1  $ping2 ) {
set-state two
}
}

state two {

init {
run logger -p console.notice -t ifstated 'Restarting
network !'
}

if ( $ping  $ping2 ) {
set-state one
}
}

==

# ifstated -dv
ping1 = ( ping -q -c 1 -t 3 www.site1.com  /dev/null every 10 ) 
ping2 = ( ping -q -c 1 -t 3 www.site2.com  /dev/null every 10 ) 
ifstated: initial state: one
ifstated: changing state to one
ifstated: running ping -q -c 1 -t 3 www.site1.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null
ifstated: started
ifstated: changing state to two
ifstated: running ping -q -c 1 -t 3 www.site1.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null


As you can see, after change state ifstated execute only the *last* check
command of the statement (ping2) forever

This is the expected behavior ?




This shouldn't execute all state body until state change  ??



Thanks for any help.

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


ifstated check commands behavior

2007-03-14 Thread Alexandre Biancalana

Hi list,

 I'm trying to setup ifstated to check two links and if some go down, do
some actions like change pf rules and machine's route.

 My doubt is about the execution order/repetition of the states body of
ifstated.conf, in all configs that I tried just the last check is executed
always, follow and example:

ifstated.conf:
==
loglevel debug

ping1 = '( ping -q -c 1 -t 3 www.site1.com  /dev/null every 10 ) '
ping2 = '( ping -q -c 1 -t 3 www.site2.com  /dev/null every 10 ) '

state one {
   if ! ( $ping1  $ping2 ) {
   set-state two
   }
}

state two {

   init {
   run logger -p console.notice -t ifstated 'Restarting
network !'
   }

   if ( $ping  $ping2 ) {
   set-state one
   }
}

==

# ifstated -dv
ping1 = ( ping -q -c 1 -t 3 www.site1.com  /dev/null every 10 ) 
ping2 = ( ping -q -c 1 -t 3 www.site2.com  /dev/null every 10 ) 
ifstated: initial state: one
ifstated: changing state to one
ifstated: running ping -q -c 1 -t 3 www.site1.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null
ifstated: started
ifstated: changing state to two
ifstated: running ping -q -c 1 -t 3 www.site1.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com  /dev/null


As you can see, after change state ifstated execute only the *last* check
command of the statement (ping2) forever

This is the expected behavior ?

I'm running 6-STABLE + ifstated-20050505 (instaled via
/usr/ports/net/ifstated)

Thanks for any help.

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


Translate job number from atq to commands that will run

2006-12-16 Thread JAMES T RIENDEAU
Does anybody know how I could translate the job # into the commands  
that will run from the output of the atq command?  For example, here  
is my current atq:


DateOwner   Queue   Job #
Mon Dec 18 09:00:00 CST 2006rootc   34
Wed Dec 20 09:00:00 CST 2006rootc   35
Fri Dec 22 09:00:00 CST 2006rootc   36
Wed Dec 27 09:00:00 CST 2006rootc   37
Sat Dec 30 09:00:00 CST 2006rootc   38
Wed Jan  3 09:00:00 CST 2007rootc   39
Sat Jan  6 09:00:00 CST 2007rootc   40
Mon Dec 18 09:00:00 CST 2006rootc   41
Wed Dec 20 09:00:00 CST 2006rootc   42
Fri Dec 22 09:00:00 CST 2006rootc   43
Wed Dec 27 09:00:00 CST 2006rootc   44
Sat Dec 30 09:00:00 CST 2006rootc   45
Wed Jan  3 09:00:00 CST 2007rootc   46
Sat Jan  6 09:00:00 CST 2007rootc   47

I checked the /var/at/spool and /var/at/jobs, but it isn't obvious  
which job is scheduled to run when.


Thank you,

James Riendeau
MMI Computer Support Technician
1300 University Ave
Rm. 436, Dept. of MedMicro
Madison, WI  53706

Phone: (608) 262-3351
Email: [EMAIL PROTECTED]



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


Re: Translate job number from atq to commands that will run

2006-12-16 Thread Dan Nelson
In the last episode (Dec 16), JAMES T RIENDEAU said:
 Does anybody know how I could translate the job # into the commands  
 that will run from the output of the atq command?  For example, here  
 is my current atq:
 
 Date  Owner   Queue   Job #
 Mon Dec 18 09:00:00 CST 2006  rootc   34
...
 Sat Jan  6 09:00:00 CST 2007  rootc   47
 
 I checked the /var/at/spool and /var/at/jobs, but it isn't obvious  
 which job is scheduled to run when.

at -c n will list the commands to be run for job n.

The filenames in /var/at/jobs are of the format qn, where
q is the queue, n is the job number in hex, and t is the time the job
is scheduled in hex (in minutes from the Epoch, so multiply by 60 to
get the more-standard seconds from Epoch).  For more info, see at at
manpage and /usr/src/usr.bin/at/at.c .

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


Re: Translate job number from atq to commands that will run

2006-12-16 Thread James Long
 Date: Sat, 16 Dec 2006 16:54:58 -0600
 From: JAMES T RIENDEAU [EMAIL PROTECTED]
 Subject: Translate job number from atq to commands that will run
 To: freebsd-questions@freebsd.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
 
 Does anybody know how I could translate the job # into the commands  
 that will run from the output of the atq command?  For example, here  
 is my current atq:
 
 Date  Owner   Queue   Job #
 Mon Dec 18 09:00:00 CST 2006  rootc   34
 Wed Dec 20 09:00:00 CST 2006  rootc   35
 Fri Dec 22 09:00:00 CST 2006  rootc   36
 Wed Dec 27 09:00:00 CST 2006  rootc   37
 Sat Dec 30 09:00:00 CST 2006  rootc   38
 Wed Jan  3 09:00:00 CST 2007  rootc   39
 Sat Jan  6 09:00:00 CST 2007  rootc   40
 Mon Dec 18 09:00:00 CST 2006  rootc   41
 Wed Dec 20 09:00:00 CST 2006  rootc   42
 Fri Dec 22 09:00:00 CST 2006  rootc   43
 Wed Dec 27 09:00:00 CST 2006  rootc   44
 Sat Dec 30 09:00:00 CST 2006  rootc   45
 Wed Jan  3 09:00:00 CST 2007  rootc   46
 Sat Jan  6 09:00:00 CST 2007  rootc   47
 
 I checked the /var/at/spool and /var/at/jobs, but it isn't obvious  
 which job is scheduled to run when.
 
 Thank you,
 
 James Riendeau
 MMI Computer Support Technician
 1300 University Ave
 Rm. 436, Dept. of MedMicro
 Madison, WI  53706
 
 Phone: (608) 262-3351
 Email: [EMAIL PROTECTED]

man at

Note the -c flag.


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


Re: [EMAIL PROTECTED]: The results of your email commands]

2006-10-26 Thread Jonathan Arnold

Gary Kline wrote:

Folks, how can I un-sub from the -queestions list that is sent to [EMAIL 
PROTECTED] when the mailer thinks I am NOT a Subscriber???  See my //HERE
tag below


Can't you unsubscribe via the web interface:

http://lists.freebsd.org/mailman/listinfo/freebsd-questions

--
Jonathan Arnold (mailto:[EMAIL PROTECTED])
Daemon Dancing in the Dark, a FreeBSD weblog:
http://freebsd.amazingdev.com/blog/

UNIX is user-friendly. It's just a bit picky about who its friends are.

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


  1   2   3   >