[131086150010] |
date
.
[131086180020] |Type info date
or man date
for details.
[131086180030] |Something like the following might suit you (change the date format to your needs)
[131086190010] |You could try something like this:
[131086190020] |To see if your particular cron will run the command out of crontab as a script in and of itself, or if you need to write a script that figures out the date as a string, and then runs your mysqldump command.
[131086190030] |"cron" on Redhat Enterprise Linux 5.0 (I think) did not like the "$()" construct, and kept giving me errors about not finding a matching ')'.
[131086190040] |NOTE: As glenn jackmann notes below, you have to escape all '%' characters.
[131086190050] |works under RHEL 5.0.
[131086190060] |I would also take the recommendation to use ISO8601 date format (yyyy-mm-dd) to make the file names order by date when sorted lexically.
[131086200010] |Here's the bash script I used:
[131086200020] |Files look like:
[131086200030] |Point the cron job at this to run nightly or whatever you prefer.
[131086210010] |/etc/grub.d/40_custom
.
[131086250020] |Works for me :) Just remember to subsitude hd0,3
with your correct entry
[131086260010] |export
and setenv
?
[131086270010] |there is none but:
[131086270020] |setenv
is the name of the command in the *csh family of shells
[131086270030] |export
is the name of the command in the "other" family of shells (ash, bourne, bourne again, zsh)
[131086270040] |and, ok, the syntax is slightly different. but other than that? none.
[131086280010] |tail -f
keeps the file open in case more data arrivesapt-get install apache2 php5 libapache2-mod-php5
.
[131086330050] |But there was no change.
[131086330060] |Console output: http://pastebin.com/sVMWq6mA
[131086330070] |This is everything in my /etc/apache2/mods-enabled
: http://img35.imageshack.us/img35/6474/modsb.jpg
[131086330080] |My webserver can be accessed here: http://206.217.223.136/test/ In my test.php file I have the code :
[131086330090] |but instead of displaying the page, it tries to download it.
[131086330100] |How can I fix this?
[131086340010] |I think you probably missed restarting apache2...
[131086340020] |You will have to run this command from your root account, or put sudo on the beginning of it.
[131086340030] |For full details on installing PHP5 - use the official php5 on debian instructions HERE
[131086350010] |Run below commands again and check...
[131086360010] |date +format
:
[131086400010] |/usr/bin/scp -P 1234 -i /path/key_rsa /home/path/filename.txt user@remotehost:/tmp
[131086400040] |I'm working on a schell script, that will use ssh
, but not sure how to use that same port of 1234
.
[131086400050] |I tried /usr/bin/ssh -D 1234 remotehost '. ~/my_profile; mkdir /test'
and its asking for the user pw.
[131086400060] |I know the keys are already established since the scp works fine for that user.
[131086400070] |What am I doing wrong?
[131086400080] |Thanks.
[131086410010] |You want to use the -p
option; -D
is for dynamic port forwarding, that is to say creating port forwardings on an existing connection.
[131086420010] |cat
a stream like /dev/input/event0
.
[131086420030] |I want to write a script that does something every time there is more output.
[131086420040] |The definition of more output might be every time it reads a byte.
[131086420050] |How can that be done? is there some command that does it?
[131086430010] |From a shell script you will be limited to complete lines.
[131086430020] |You'll need to use C/Perl/Python/whatever for finer grained reading.
[131086440010] |A variation on geekosaur's answer: You might want to try read -n 1 byte
to read one byte at a time, then do something with $byte
.
[131086440020] |EDIT:
[131086440030] |Just tried this as I had never used that command before (just looked up info bash
), but it seems to munch all white space and line endings.
[131086440040] |I don't have an explanation for this yet.
[131086440050] |Try the following scripts to fine tune command arguments:
[131086440060] |So unfortunately this does not give the expected result.
[131086440070] |EDIT (with Chris' help):
[131086440080] |This gives exactly the expected result.
[131086440090] |Note: whether I use -n
, -N
, or -rN
does not change the result, it's all good (with text, I did not test the limitation that Chris talks about: 0x00 and 0xff).
[131086450010] |p
) everything between lines 3 and 10.
[131086470030] |The -n
tells it to do it quietly, otherwise it prints out the input as its reading the file.
[131086480010] |pkgadd -d /path/to/cdrom/Product SUNWjaf SUNWjato SUNWjmail
or whatever the parent directory is containing those subdirectories.
[131086500010] |/bin/false
or /sbin/nologin
(if the latter is available).
[131086520010] |/System/Library/LaunchDaemons
, which is reserved for services provided with OSX; it should have been in /Library/LaunchDaemons
.
[131086540010] |mplayer
and what features you want to use.
[131086550040] |In general, you're better off with the pre-built one; mplayer
is an absolute beast to build.
[131086560010] |I was about to say the same thing as @geekosaur, but noticed in the comments that you don't have internet connection on that PC.
[131086560020] |In general, on Linux software is divided into packages (mplayer
, sudo
, zypper
are examples of packages).
[131086560030] |Packages are stored in repositories and have dependencies on other packages.
[131086560040] |To save you the task of managing them, there are package managers, such as zypper
.
[131086560050] |You don't normally install software from source, but use the package manager that comes with your system.
[131086560060] |Now the big problem is that you don't have internet connection on the computer that you want to install software on.
[131086560070] |If possible, it's a lot easier to plug the cable in and let zypper
download what it needs.
[131086560080] |If that's not possible, most package managers have the ability to install from a local repository.
[131086560090] |I'm not a SUSE user, but from the documentation you can download the required .rpm files to make a local repository, then tell zypper
about it:
[131086560100] |After that you can install mplayer
without internet connection:
[131086560110] |If zypper
then tells you that it needs to install other packages as dependencies (and it will fail because there is no internet connection), you will have to look for the RPM files it need, download and put them in my/dir/with/rpms
(BTW that's a fake path, change it to whatever path you store the files).
[131086570010] |$ wget -q "http://downloads.openwrt.org/backfire/10.03/ar71xx/packages/" -O - | grep -i ebtables
$
[131086570170] |p.s.: The rule would be [is it on a good chain?]: iptables -A FORWARD -m iprange --src-range 192.168.1.2-192.168.1.255 --dst-range 192.168.1.2-192.168.1.255 -j DROP Thank you!
[131086580010] |If you want to separate wireless and wired users why not match the interfaces?
[131086580020] |Assuming ppp0 is facing the internet, eth0 is your local LAN and wlan0 is the wireless:
[131086580030] |If you use this:
[131086580040] |--src-range
-j LOG
or -j NFLOG
before the ACCEPT rule with the same matching rules.
[131086580170] |Since you are configuring a computer which is only accessible from the network you should be very careful not to lock yourself out.
[131086580180] |You can't just walk to it and delete the rules manually.
[131086580190] |In particular typing iptables -P INPUT DROP
with an empty INPUT chain will kill your SSH session.
[131086580200] |I recommend using the iptables-save
and iptables-restore
and writing the rules in a config file.
[131086580210] |It also helps if you can test the rules on a computer with a keyboard and monitor before trying it on the router.
[131086590010] |shell> fsck -N /dev/sda1
[131086610010] |Fsck returns your filesystem to a consistent state.
[131086610020] |This is not necessarily the filesystem's “latest” state, because that state might have been lost in the crash.
[131086610030] |In fact, if there were half-written files at the time of the crash, then the filesystem was not left in a consistent state, and that is precisely what fsck is designed to repair.
[131086610040] |In other words, after running fsck, your filesystem is as up-to-date as it can get.
[131086610050] |If your application requires feedback as to what is stored on the disk in case of a crash, you'll need to do more work than just writing to a file.
[131086610060] |You need to call sync
, or better fsync
, after a write operation to ensure that that particular write has been committed to the disk (but if you end up doing this a lot, your performance will drop down, and you'll want to switch to a database engine).
[131086610070] |You'll need a journaled filesystem configured for maximum crash survival (as opposed to maximum speed).
[131086610080] |The property that an operation (such as a disk write) that has been performed cannot be undone (even in the event of a system crash) is called durability.
[131086610090] |It's one of the four fundamental properties of databases (ACID).
[131086610100] |If you need that property, read up on transactions.
[131086610110] |Although filesystems are a kind of database, they're usually not designed to do well with respect to ACID properties: they have more emphasis on flexibility.
[131086610120] |You'll get better durability from a dedicated database engine.
[131086610130] |Then consider what happens in case your disk, and not your system crashes: for high durability, you also need replication.
[131086620010] |/tmp
and /var
directories are the ones that many system programs write to a lot, and depend on being writeable.
[131086670020] |Minimizing writes to these directories, or configuring Linux to mount these directories on external storage devices that are replaceable, as opposed to on board flash, would go a long way towards accomplishing your goal.
[131086670030] |/home
and swap partition should be treated the same way.
[131086670040] |rsyslogd
, the default syslogd in Debian and many Debian-derived distros, has the capability to not write logs to disk, but ship them over a network connection, and only write them to storage if an internal buffer gets full.
[131086670050] |Implementing this (which I'm trying to figure out how to do currently in a good way) could eliminate a lot of flash writes.
[131086670060] |Also, you want to mount your file systems with the noatime
option which prevents Linux from updating the access time on each file you touch.
[131086670070] |This can also eliminate a lot of writes and speed up performance.
[131086670080] |I think there's also a kernel parameter that controls the time interval between Linux's automatic sync
call.
[131086670090] |If your system doesn't expect to experience sudden power outages you could set that to a higher value than the default of 5 seconds (I think).
[131086680010] |It would be more proper to say Flash Memory has only a limited number of erase cycles, these caused eventually by writes.
[131086680020] |There are many good articles available about this distinction.
[131086680030] |When you mention burning a Linux image into router firmware, that is probably NOR flash or an EEProm.
[131086680040] |NOR is the type of flash with quicker reads, NAND the type with quicker writes.
[131086680050] |Under ext3, the journal is the most frequently written file, and those writes will eventually fill a block, forcing the erase of another block.
[131086680060] |Setting a larger commit=
value on mount would gather these journal writes into larger chunks.
[131086680070] |Finally, to echo other solutions, mounting with noatime
is a standard practice that will reduce impact.
[131086690010] |/usr/local/bin
in my path:
[131086690030] |And likewise when running su
:
[131086690040] |However, when running via sudo
, this directory is not in the path:
[131086690050] |Why would the path be different when running via sudo
?
[131086700010] |sudo bash
is starting a completely new shell. su
doesn't do this unless you use the -
option, I think.
[131086700020] |bash
when invoked will run commands in ~/.bash_profile
and ~/.bashrc
.
[131086700030] |There's likely a PATH=...
command in one of those files in /root
or wherever Fedora puts the root user's home directory.
[131086710010] |In most linuxes, you install programs via the package management, and get updates in a regular way.
[131086710020] |If you install something circumventing the package management it will be installed in /usr/local/bin (for example, or .../sbin, or /opt) and not get regular updates.
[131086710030] |I guess therefore the programs aren't considered to be that secure, and not put into roots PATH by default.
[131086720010] |I've just tried this out for myself and I didn't see the behaviour you were seeing - my path remained the same, so maybe your sudo configuration is different.
[131086720020] |If you check man sudoers
you'll see there is an option called secure_path
which resets PATH
- it sounds like this option might have been enabled.
[131086730010] |Take a look at /etc/sudoers
.
[131086730020] |The default file in Fedora includes this line:
[131086730030] |Which insures that your path is clean when running binaries under sudo.
[131086730040] |This helps protect against some of the concerns noted in this question.
[131086730050] |It's also convenient if you don't have /sbin
and /usr/sbin
in your own path.
[131086740010] |Because when you use sudo bash
, bash
doesn't not act as a login shell.
[131086740020] |Try again with sudo bash -l
and you should see the same result as su -
.
[131086740030] |If that is correct, then the difference in PATH
lies in the configuration files: /etc/profile
, ~/.bash_profile
, ~/.bash_login
, ~/.profile
are executed (in that order) for a login shell, while ~/.bashrc
is executed for a non-login interactive shell.
[131086750010] |The command su -
will execute the root users profile and take on that user's environment including path etc. sudo
does not do that.
[131086750020] |If you'd like sudo
to behave like su -
then use the option sudo -i [command
which will execute the user's profile
[131086750030] |If you'd like su -
to behave like sudo
then don't use the hyphen - just use su [command]
[131086760010] |{}
being masked.
[131086760050] |Here is a simple test:
[131086760060] |Is there a shell, for which I really need to mask the braces?
[131086760070] |Note, that it doesn't depend upon whether the file found contains a blank (invoked from bash):
[131086760080] |This changes if the found file is passed to a subshell:
[131086760090] |in contrast to:
[131086760100] |but that's not what the man page is talking about, is it?
[131086760110] |So which shell treats {} in a different way?
[131086770010] |In a word, csh
. bash
and other modern shells recognize that the user probably isn't asking for a null brace expansion.
[131086770020] |(Modern csh
is actually tcsh
and may also handle {}
sanely by now.)
[131086780010] |Summary: If there ever was a shell that expanded {}
, it's really old legacy stuff by now.
[131086780020] |In the Bourne shell and in POSIX-compliant shells, braces ({
and }
) are ordinary characters (unlike (
and )
which are word delimiters like ;
and &
, and [
and ]
which are globbing characters).
[131086780030] |The following strings are all supposed to be printed literally:
[131086780040] |A word consisting of a single brace is a reserved word, which is only special if it is the first word of a command.
[131086780050] |Ksh implements brace expansion as an incompatible extension to the Bourne shell.
[131086780060] |This can be turned off with set +B
.
[131086780070] |Bash emulates ksh in this respect.
[131086780080] |Zsh implements brace expansion as well; there it can be turned off with set +I
or setopt ignore_braces
or emulate sh
.
[131086780090] |None of these shells expand {}
in any case, even when it's a substring of a word (e.g. foo{}bar
), due to the common use in arguments to find
and xargs
.
[131086780100] |Single Unix v2 notes that
[131086780110] |In some historical systems, the curly braces are treated as control operators.
[131086780120] |To assist in future standardisation activities, portable applications should avoid using unquoted braces to represent the characters themselves.
[131086780130] |It is possible that a future version of the ISO/IEC 9945-2:1993 standard may require that {
and }
be treated individually as control operators, although the token {}
will probably be a special-case exemption from this because of the often-used find
{}
construct.
[131086780140] |This note was dropped in subsequent versions of the standard; the examples for find
have unquoted uses of {}
, as do the examples for xargs
.
[131086780150] |There may have been historical Bourne shells where {}
had to be quoted, but they would be really old legacy systems by now.
[131086780160] |The csh implementations I have at hand (OpenBSD 4.7, BSD csh on Debian, tcsh) all expand {foo}
to foo
but leave {}
alone.
[131086790010] |/bin/
/sbin/
/usr/bin/
/usr/local/bin/
/usr/local/sbin/
sbin
directories contains programs which are generally system administration only.
[131086800020] |Programs for regular users should never go in them.
[131086800030] |A few programs are needed during startup, and end up in /bin/
or /sbin/
.
[131086800040] |These must be available before files systems are mounted.
[131086800050] |Things like mount
, and fsck
that are required to check and mount files systems must be there.
[131086800060] |Most packaged programs end up in /usr/bin/
and /usr/sbin/
.
[131086800070] |These may be on a file system other than the root file system.
[131086800080] |In some cases they may be on a network mounted drive.
[131086800090] |Local programs and scripts belong in /usr/local/bin/
and /usr/local/sbin/
.
[131086800100] |This identifies them as clearly non-standard, and possibly only available on site.
[131086800110] |For further explanation try running the command man hier
which should provide a description of the recommended file system hierarchy for your distribution.
[131086800120] |You may also want to read about the File System Hierarchy on Wikipedia
[131086810010] |/bin
(and /sbin
) were intended for programs that needed to be on a small /
partition before the larger /usr
, etc. partitions were mounted.
[131086810020] |These days, it mostly serves as a standard location for key programs like /bin/sh
, although the original intent may still be relevant for e.g. installations on small embedded devices./sbin
, as distinct from /bin
, is for system management programs (not normally used by ordinary users) needed before /usr
is mounted./usr/bin
is for distribution-managed normal user programs./usr/sbin
with the same relationship to /usr/bin
as /sbin
has to /bin
./usr/local/bin
is for normal user programs not managed by the distribution package manager, e.g. locally compiled packages.
[131086810070] |You should not install them into /usr/bin
because future distribution upgrades may modify or delete them without warning./usr/local/sbin
, as you can probably guess at this point, is to /usr/local/bin
as /usr/sbin
to /usr/bin
./opt
which is for monolithic non-distribution packages, although before they were properly integrated various distributions put Gnome and KDE there.
[131086810100] |Generally you should reserve it for large, poorly behaved third party packages such as Oracle.
[131086820010] |I recommend taking a look at the file system hierarchy man page: man hier
[131086820020] |which is lso available online, for instance http://linux.die.net/man/7/hier
[131086830010] |The Filesystem Hierarchy Standard entry in Wikipedia helped me answer the same question when I had it, plus it has a very explanatory table.
[131086840010] |$FEDORA/boot/grub/grub.conf
into your Backtrack grub.conf
.
[131086860040] |Not Fedora, but quick and easy.
[131086860050] |Alternatively:
[131086860060] |Mount the proc filesystem so that Fedora will see it too:
[131086860070] |Chroot into Fedora:
[131086860080] |Here should come some magic to sanitize the chroot environment, I have no idea how that should look like in Fedora.
[131086860090] |This is Gentoo:
[131086860100] |Now, fire up grub:
[131086860110] |Grub commands copied from the Gentoo page:
[131086860120] |Here, (hd0)
is the first hard drive, and (hd0,0)
is the first partition on it. /dev/sda5
usually comes out as (hd0,4)
, but make sure to double-check everything as you go along.
[131086860130] |Grub has auto-complete, so it should be easy.
[131086860140] |A word of advice, whichever route you take: when you remove either distro, make sure you remember where your system boots from!
[131086870010] |Backtrack probably overwrite the MBR with its records, thus causing the Backtrack GRUB to show up instead of the Fedora one.
[131086870020] |Now to bring back the Fedora GRUB you need to tell grub
to create appropriate records in the MBR.
[131086870030] |See the question restore suse grub for how to restore GRUB.
[131086870040] |You didn't mention if you are using Grub Legacy or Grub 2, but if both your Fedora and Backtrack installations use Grub 2 you can (from my answer on the linked question):
[131086870050] |/mnt/fedora
grub-setup -d /mnt/fedora /dev/sda
screen
to do this.
[131086890020] |Although, the only method I know of does produce some security concerns.
[131086890030] |Screen has the ability to create access control lists and the ability to allow multiple screen sessions with a variety of permissions.
[131086890040] |The setup can be a bit tricky, but the idea is this:
[131086890050] |/var/run/screen
to 755 (Other permissions setups might be doable, this is just what I've always done.
[131086890090] |Also, this is the path on Debian, I'm unsure if it is different elsewhere)~/.screenrc
to enable multiuser mode:
[131086890110] |~/.screenrc
to set up the right permissions using the commands: acladd
, aclchg
, and aclgrp
.
[131086890120] |See the man pages for the details.ssh
config, you could actually force him to connect to the screen session upon his logging in.
[131086890150] |The following blog post has more detailed instructions (these directions are roughly based off of them) in the context of holding a class using screen:
[131086890160] |http://blog.dustinkirkland.com/2009/04/teaching-class-with-gnu-screen.html
[131086890170] |Your use case is a bit different, but I think that the only real difference will be the permissions you set in ~/.screenrc
and the name of the user.
[131086900010] |screen -x
ought to be the simplest solution.
[131086910010] |iptraf
to see if your machine makes any suspisious connections (if someone got/has unauthorized access).
[131086920030] |Run a rkhunter
scan: aptitude install rkhunter
rkhunter --update
rkhunter --check
[131086920040] |And should it ever happen again, attach a monitor and see what the console says :)
[131086930010] |Assuming your computer is usually stable, check for hardware problems, especially with the RAM (i.e. install memtest86+
and choose memtest at the boot prompt), but also with disks (disk errors sometimes crash the filesystem code; install smartmontools
and run smartctl -a /dev/sda
).
[131086930020] |If the problem was gradual, you may find something in the kernel logs (/var/log/kern.log
), but often the crash happens too brutally for anything to be written to the logs.
[131086940010] |By this -
[131086940020] |How can I find out what happened to it?
[131086940030] |I presume you want to know what happened during your failed attempt at SSH!
[131086940040] |One place to look into will be /var/log
.
[131086940050] |Something like grep -ir ssh /var/log/*
should give you the SSH related log entries.
[131086950010] |encryption
and directories
, but lack the rep to create a tag.)
[131086960010] |How about using gpgdir?
[131086960020] |This should be scriptable for login and logout.
[131086960030] |You can also select subdirectories which are supposed to be encrypted (you may want file such as .bash_rc
to remain decrypted, for example).
[131086960040] |Another alternative may be Truecrypt (missing rep. does not allow a link): You can create a container for your data and encrypt/decrypt it via shell scripts.
[131086970010] |Do you have administrative access to the machines?
[131086970020] |One could use an encrypted loopback device.
[131086970030] |Example:
[131086970040] |make a container file for the encrypted fs: dd if=/dev/zero of=container bs=1024k count=100
[131086970050] |bind container file to loopback device 0: losetup container /dev/loop0
[131086970060] |create encrypted device (-y asks for passphrase twice): cryptsetup -c serpent-xts-essiv:sha256 -b 512 -y create container /dev/loop0
[131086970070] |create ext2 filesystem on encrypted device (can use anything really): mkfs.ext2 /dev/mapper/container
[131086970080] |mounts encrypted filesystem to crypt directory: mount /dev/mapper/container crypt
[131086970090] |--
[131086970100] |man cryptsetup &&man losetup
[131086970110] |Also, read up on cryptography best practises, for information on choosing cipher and key lengths to use etc.
[131086980010] |You could also use ecryptfs, which is standard on Ubuntu and its derived distributions.
[131086980020] |That's what is used when the install process asks you if you want to crypt your home directory (http://www.linuxjournal.com/article/9400).
[131086980030] |The advantage of ecryptfs is that you don't need a separate partition, or a loopback mounted file to use it.
[131086990010] |It looks like what you're after is not a way to encrypt and decrypt directories, but a way to work with encrypted storage transparently.
[131086990020] |Note that the scheme you propose, with actual mass decryption and encryption, is not very secure: it leaves things unencrypted if you don't log out normally (power failure, system crash, stolen laptop...); and it leaves traces of your confidential data that a determined attacker could find (the data from erased files is still on the disk, just hard to find).
[131086990030] |Current Linux systems offer several ways to achieve transparent encryption.
[131086990040] |You can encrypt a whole volume with dm-crypt or one of its alternatives.
[131086990050] |There are several tools available to encrypt a specific directory tree, including ecryptfs (which works at the kernel level) and encfs (which works purely in userland via fuse).
[131086990060] |(The three I mention are available in Debian lenny and should be offered by all of your distributions.)
[131086990070] |You can set up the encrypted directories to be mounted when you log in either via PAM (libpam-mount
package; recommended option for ecryptfs) or through your profile scripts (recommended option for encfs).
[131086990080] |Note that there is no problem with “forgetting to encrypt manually” since nothing is ever written unencrypted to the disk.
[131086990090] |For best protection, you should encrypt not just your confidential files, but also other places where confidential data may be stored by programs.
[131086990100] |At least, you should encrypt your swap partition.
[131086990110] |Other places to watch include /tmp
(best solved by making it tmpfs
), /var/spool/cups
if you print confidential documents, and per-application files in your home directory such web caches/histories (e.g. ~/.mozilla
).
[131087000010] |brctl show
[131087000090] |Output from route
:
[131087000100] |Finally, here's the networking section of the vm I'm trying to configure:
[131087010010] |KVM sets up its own bridge.
[131087010020] |This is the bridge virbr0
.
[131087010030] |You should be able to configure how this is networked.
[131087010040] |On the VM the interface should show up at eth0
not a bridge.
[131087010050] |This will be the other side of the vnet0
device.
[131087010060] |I work on Ubuntu where KVM will startup a DNSMasq server for the bridged network to hand out DHCP addresses.
[131087010070] |KVM will also play with iptables
to configure access to the network for your VM.
[131087010080] |Try removing the bridge you created and restarting the VM.
[131087010090] |I would expect it to get an address in the 192.168.122.0 range from what I see of your configuration.
[131087010100] |I didn't like how KVM was interacting with my firewall, so did my own manual networking for KVM.
[131087010110] |My configuration uses a virtual bridge which isn't connected to an Ethernet interface.
[131087010120] |The KVM Networking page from the Ubuntu community may help you understand how KVM is doing networking now.
[131087010130] |EDIT: I took a second look at the bridged networking.
[131087010140] |I am not sure why you have an 192.168.1.x address on eth1
.
[131087010150] |You configuration looks pretty much as I would expect.
[131087010160] |Try setting a static address on the VM to see if it can communicate.
[131087010170] |To test to see what is happening with DHCP, I would try running tcpdump
on br0
or eth0
watching for DHCP traffic, or any traffic from mac address 54:52:00:1a:c8:4f
.
[131087010180] |Then try to get a DHCP address.
[131087010190] |You may need to enable SPT on the bridge.
[131087010200] |The reason I did my own networking was to enable access to my VMs from the outside.
[131087010210] |I run two bridges, one of which hosts my DMZ.
[131087020010] |/user
and /temp
instead?
[131087020040] |All the other directories under root
seem to be exactly what one would guess them to be, but these two seem odd, I would have always guessed them as user
and temp
.
[131087020050] |Is there some historical reason for the spellings?
[131087030010] |Yup there were reasons.
[131087030020] |They are pronounced user and temp. passwd is similar, as is resolv.conf.
[131087030030] |Unix is an expert friendly, user antagonistic operating system.
[131087030040] |I was a student when 300 Baud modems were the norm.
[131087030050] |I was the envy of my fellow students, since I had a Silent 700 terminal from Control Data where I was working.
[131087030060] |You could see the delay from typing each character and waiting for it to be echoed.
[131087030070] |Every character counted; I also see it as fostering the start of leet speak.
[131087030080] |The hjkl from vi have a history which few know. vi was developed by Bill Joy when he was a grad student at UCB during these same years.
[131087030090] |The ADM 3a terminals in Cory Hall had arrow keys above those letters
[131087040010] |They are holdover from Unix.
[131087040020] |Memory and disk space was in short supply.
[131087040030] |Hacking out a few vowels and other abbreviations gave real savings.
[131087040040] |A few disk blocks or a few bytes could mean the difference in being able to run a program or not.
[131087040050] |(I once had to trim a program by 24 bytes before it would run.)
[131087040060] |Also as Tom noted terminal speeds were slow.
[131087040070] |1200 baud was introduced as high speed and it was.
[131087040080] |I worked with one system that used a half speed teletype (55 baud or 5 cps) as the console.
[131087040090] |On systems running graphical interfaces it generally doesn't matter that much as the average users won't be poking around in them.
[131087040100] |The directories are usually well documented in the hier
man page.
[131087040110] |Changing over to longer names would cause a lot of problems for existing programs.
[131087040120] |It would also limit script portability.
[131087040130] |Linking multiple names to the same directories would likely be more confusing than helpful.
[131087040140] |EDIT: PDP-7 on which Unix was developed had a base configuration of 4KW of memory and a maximum of 32KW.
[131087040150] |Words where 18 bits wide.
[131087040160] |Input was a teletype, so speed was likely 110 baud or 10cps, roughly 100 words which is significantly slower than speech.
[131087050010] |I'm surprised that nobody has commented on /user
yet.
[131087050020] |This one is obvious: because it's not "user", it's "Universal System Resources".
[131087050030] |As for /tmp
, it's simply shorter and easier to type.
[131087050040] |C programmers have a habit of using short names when possible because they end up typing them many times in a program.
[131087050050] |It is very common have a temporary variable named "tmp" rather than "temp" for the same reason, you use "i" i for the index in a for loop instead of "index" or "counter".
[131087060010] |All the other directories under root seem to be exactly what one would guess them to be,
[131087060020] |There is also /var, /mnt and /opt ;)
[131087060030] |but these two seem odd, I would have always guessed them as user and temp.
[131087060040] |Almost there.
[131087060050] |As Shawn said, "user" stands for "Universal System Resources" (though other resources according to teh google indicates it stands for "Unix System Resources").
[131087060060] |Is there some historical reason for the spellings?
[131087060070] |Short cuts, abbreviations.
[131087060080] |Remember that commands in any operating system are meant for accessing both interactively and programmatically.
[131087060090] |In particular for systems administration where fast scripting is one primary concern, abbreviations, mnemonics are as good (or even better) than the full spelled word/command.
[131087060100] |Also, back in the day, if you were connecting remotely through a slow-as-molasses modem, shaving a couple of vowels here and there would make your life easier (or less miserable if you were a sysadmin trying to find out what the hell is wrong with a remote box.)
[131087060110] |As said before, it is not unique to /usr and /tmp (see /var, /mnt and /opt).
[131087060120] |Also, it is not unique to Unix.
[131087060130] |Take DOS for example (chkdsk, for example.) Mnemonics where you shave off vowels are a powerful, handy concept.
[131087060140] |Even in natural languages (like Semitic languages) the concept exist (where root of words are universally and almost unambiguously identified by 3-consonant groups.)
[131087060150] |It is an innate human mechanism for managing information.
[131087070010] |~/.bashrc
(if your shell is bash).
[131087080030] |This way it's executed every time you start a new shell session.
[131087090010] |For more information on how to set JAVA_HOME in Mac OSX, there is an existing post http://stackoverflow.com/questions/603785/environment-variables-in-mac-os-x
[131087100010] |As mentioned by others, export
only applies to the current shell and programs started from it after it is used.
[131087100020] |(Note that open
relays its command to the Finder, so programs started that way don't get environment variables from the shell it's run in.)
[131087100030] |One way to set environment variables persistently is to add to ~/.bash_profile
or ~/.bashrc
(the former is preferred, as otherwise subshells will override the export
if you change it for some reason, say because you need a different JRE for some particular Java program).
[131087100040] |Another is to set them in ~/.MacOSX/environment.plist
; this is the only way to set environment variables so that the Finder will see them.
[131087100050] |I prefer to use the Environment Variable Preference Pane to manage ~/.MacOSX/environment.plist
.
[131087100060] |You can also edit it by hand (watch out; it's XML).
[131087100070] |You will have to log out or reboot to get Finder to reread it after changing it.
[131087110010] |ps ax | grep ntpd
[131087120030] |and checking that the output contains something like
[131087120040] |will confirm that ntpd is running.
[131087120050] |If it's not running then you can start it with
[131087120060] |/etc/init.d/ntp start
[131087120070] |If you get an error message No such file or directory
then you will have to install the ntp package
[131087120080] |sudo apt-get install ntp
[131087120090] |Once you have ntpd running you can talk to it with the ntpq command.
[131087120100] |Which shows (offset) that my system is <1 second out of sync - I can live with that.
[131087130010] |If you have peer statistics enabled in your /etc/ntp.conf
then you have statistics in /var/log/ntpstats/peerstats
.
[131087130020] |(Directory and file name will be specified in ntp.conf).
[131087130030] |You can scan it to see how well you are tracking your servers.
[131087130040] |The command grep -v 127.127.1.0 /var/log/ntpstats/peerstats
will output all the lines except those for your local clock.
[131087130050] |The first floating point number is the offset in seconds.
[131087130060] |The closer it is to zero the better.
[131087130070] |There should be a mix of positive and negative values.
[131087130080] |Use zgrep to look a historical data in the rotated logs with a .gz
extension.
[131087130090] |To see what the values are use ntpq -p
as Iain suggested.
[131087130100] |If you run Munin to monitor your system it can track you ntp statistcs for you.
[131087130110] |I believe the offset it records is the value relative to the currently synchronization source.
[131087130120] |That is the one on the line starting with an asterisk (*) in the ntpq -p
output.
[131087130130] |Munin can be configured to notify your offset is too large.
[131087130140] |My warning lines are as follows (times in milliseconds):
[131087140010] |A cheap and dirty way to check the local clock vs another machine is this shell command sequence:
[131087140020] |"somehost" has to run the RFC 867 "daytime" protocol, and that's not so common anymore. inetd can provide "daytime" by itself, and some hosts still have "daytime" enabled.
[131087140030] |You can at get an independent check on the local clock, no use of NTP necessary.
[131087150010] |shutdown -h
and shutdown -r
respectively.
[131087190020] |Bareword shutdown generally assumes -h.
[131087200010] |Generally, one uses the shutdown
command.
[131087200020] |It allows a time delay and warning message before shutdown or reboot, which is important for system administration of multiuser shell servers; it can provide the users with advance notice of the downtime.
[131087200030] |As such, the shutdown command has to be used like this to halt/switch off the computer immediately (on Linux and FreeBSD at least):
[131087200040] |Or to reboot it with a custom, 30 minute advance warning:
[131087200050] |After the delay, shutdown
tells init
to change to runlevel 0 (halt) or 6 (reboot).
[131087200060] |(Note that omitting -h
or -r
will cause the system to go into single-user mode (runlevel 1), which kills most system processes but does not actually halt the system; it still allows the administrator to remain logged in as root.)
[131087200070] |Once system processes have been killed and filesystems have been unmounted, the system halts/powers off or reboots automatically.
[131087200080] |This is done using the halt
or reboot
command, which syncs changes to disks and then performs the actual halt/power off or reboot.
[131087200090] |On Linux, if halt
or reboot
is run when the system has not already started the shutdown process, it will invoke the shutdown
command automatically rather than directly performing its intended action.
[131087200100] |However, on systems such as FreeBSD, these commands first log the action in wtmp
and then will immediately perform the halt/reboot themselves, without first killing processes or unmounting filesystems.
[131087210010] |filea
and fileb
, mv filea fileb
would
[131087250040] |fileb
filea
to fileb
dira
and dirb
, mv dira dirb
would
[131087250070] |dira
into dirb
(it will become dirb/dira
)mv dira dirb
should just overwrite dirb
with the contents of dira
(or merge the two directories under a directory named dirb
).
[131087250100] |I remember reading somewhere that a directory name with a slash (like dira/
) is treated like a directory, and name with no slash (like dira
) is treated like a file (to certain extents, of course).
[131087250110] |Anyway now I want to make the shell (zsh and possibly bash) respect my notation of a directory by using a slash.
[131087250120] |Is there a terminal option which enable me to enforce that?
[131087250130] |To clarify, here is my desired behaviour:
[131087250140] |mv dira dirb
results in dirb
being overwritten with the contents of dira
mv dira dirb/
results in dira
being moved into dirb
(in dirb/dira
)-T
(in GNU land, anyway) approximates what you want (the first case):
[131087270010] |If you just want to move everything from dira to dirb you can run mv dira/* dirb
.
[131087270020] |As per mv man page on my HP-UX.
[131087270030] |The mv command moves:
[131087270040] |+ One or more directory subtrees (directory1, [directory2, ...]) to a new or existing directory (dest-directory).
[131087280010] |nautilus-open-terminal
that does just what you asked.
[131087290020] |You should find it in the standard repositories.
[131087290030] |Once installed you should have a "Open in terminal" entry in the File menu.
[131087300010] |This tag is about windows as a GUI element.
[131087300020] |Use windows for questions about interoperability with the Windows operating system.
[131087300030] |See also desktop-environment, window-manager, x11, xorg.
[131087310010] |The window is a fundamental concept in graphical user interfaces
[131087320010] |Many unix variants provide more fine-grained file permissions than the traditional, standard triple of permissions for the owning user, the owning group and others.
[131087320020] |These permissions are expressed through access control lists.
[131087320030] |The permissions that can be expressed through ACLs vary between unix variants.
[131087320040] |suphp
for that so the php processes runs under their own user account, etc.
[131087370050] |I'm a little bit worried about the security of the system files, especially the /etc
folder.
[131087370060] |I notice that most files in this directory have permissions like:
[131087370070] |Are the read-world permissions which debian standard gives the files in /etc
really needed?
[131087370080] |What's the best mask I can give those files?
[131087370090] |Are there any files in /etc
that should be world readable?
[131087380010] |The default permissions are fine, and needed.
[131087380020] |If you e.g. didn't leave passwd world readable, a lot of user-related functionality would stop working.
[131087380030] |File such as /etc/shadow shouldn't be (and aren't) world readable.
[131087380040] |Trust the OS to get this right, unless you know very well that the OS is wrong.
[131087390010] |The passwd
needs to be world readable so that a few tools can work correctly.
[131087390020] |Despite its name, the passwords are not stored there, they are stored in the /etc/shadow
file which should have the permissions -rw-------
.
[131087390030] |The passwd-
file is likely a backup.
[131087390040] |All other "files" are directories and contain configuration files.
[131087400010] |Nearly all the configuration file needs to be world readable, how do you expect your applications to read them otherwise ?
[131087400020] |If you're really that paranoid, you can however create a groups for each application, put the needed users in them and change group owner and permission for the related configurations file.
[131087400030] |But I think this would cause a lot more harm than good.
[131087400040] |The only important file I can think of which don't have world readable permission is /etc/shadow like stated in other comments.
[131087400050] |If you want a secure Debian box, I suggest the securing Debian Howto it's a little bit old, but it gives a good overview.
[131087400060] |There is also the harden package which create some interesting dependencies and forbid installation of known vulnerable packages.
[131087410010] |Let's take a step back: If those users only need access to their home directories, most FTP servers have some config setting that only allows access to that directory, and nowhere else (most commonly by using chroot).
[131087410020] |For example, in ProFTPd, it's the DefaultRoot directive:
[131087410030] |http://www.proftpd.org/docs/faq/linked/faq-ch5.html#AEN524
[131087420010] |Everything seams fine except the phpmyadmin
directory.
[131087420020] |Be really careful to protect files so the mysql password do not leak.
[131087430010] |sed
or tr
.
[131087430060] |Just marginally faster than find and replacing first zero, then one, then two, etc. in the GUI, after all.
[131087430070] |So how do I do that?
[131087440010] |I believe what you are looking for is:
[131087450010] |To remove all digits, here are a few possibilities:
[131087450020] |If you just want to get rid of the page numbers, there's probably a better regexp you can use, to recognize just those digits that are page numbers.
[131087450030] |For example, if the page numbers are always alone on a line except for whitespace, the following command will delete just the lines containing nothing but a number surrounded by whitespace:
[131087450040] |You don't need to use the command line for this, though.
[131087450050] |Any halfway decent editor has regexp search and replacement capabilities.
[131087460010] |pool
, and then go into main
, and then d
. Install dkms_2.1.1.2-3ubuntu1_all.deb
from the dmks
folder, by double-clicking on it.
[131087470080] |3) install /pool/main/p/patch/patch_2.6-2ubuntu1_amd64.deb
by the same process
[131087470090] |4) install /pool/main/f/fakeroot/fakeroot_1.14.4-1ubuntu1_amd64.deb
[131087470100] |5) finally, install /pool/restricted/b/bcmwl/bcmwl-kernel-source_5.60.48.36+bdcom-0ubuntu5_amd64.deb
[131087470110] |if you restart, you should (fingers crossed!) be okay now.
[131087470120] |The wired ethernet not working is odd - never seen that.
[131087470130] |If it doesn't work under Windows either, I'd suggest a hardware problem is likely there.
[131087470140] |edit: the deb filenames above are for the 64bit version.
[131087470150] |For the i386 ones, just replace _amd64
with _i386
.
[131087470160] |You'll find the files you're looking for :)
[131087480010] |$HOME/.XCompose
(on a per user configuration basis) to remap custom key (two chars sequence mapped to a unique key, composition rules for dead key).
[131087500010] |apt-get install ntp
), that ifupdown
was removed.
[131087520020] |Since I did not immediately reboot, I was able to continue with the net install following this.
[131087520030] |I discovered this by completely installing Debian again, and carefully looking through the operations during that update (well, and the help of someone who knows much more about Linux than I do).
[131087520040] |Anyways, all it took to get going again was apt-get install ifupdown
and now everything is good.
[131087530010] |ssh
- the unix utility and how does it work?
[131087540040] |How is SSH protocol related to SFTP?
[131087540050] |What is sshd
?
[131087540060] |Does the command su
use ssh
or sshd
?
[131087550010] |Take a look at the OpenSSH project.
[131087550020] |It has all the info you're looking for.
[131087550030] |Briefly, the SSH protocol permits the secure (encrypted) connection between two hosts.
[131087550040] |The ssh
utility is a client program to log into a remote system using the SSH protocol, and it has a lot of other uses, too, like [reverse] tunneling/port forwarding/...
[131087550050] |sshd
it's the server software.
[131087550060] |It provides a daemon which responds to incoming SSH requests.
[131087550070] |su
has nothing to do with ssh.
[131087550080] |It's used to change the active user (the most frequent use it's to become root
).
[131087560010] |SSH (stands for "Secure SHell") is a network protocol which described in RFC4251. ssh
utility is SSH client that connects to SSH daemon and presents "Secure SHell" to user.
[131087560020] |SFTP is FTP-like protocol which works over SSH connection.
[131087560030] |su
command does not use ssh
or sshd
in any way, it just allows you to run processes with different privileges.
[131087570010] |SSH is a protocol for secure communication over an insecure network.
[131087570020] |It allows for end to end encryption of all communication such that it cannot (feasibly) be intercepted and decrytped.
[131087570030] |ssh the utility is an implementation of the protocol.
[131087570040] |SFTP is a subsystem of ssh that uses the protocol for secure password and file transfer.
[131087570050] |su does not use the ssh protocol.
[131087580010] |The SSH protocol is defined by what the ssh
and sshd
programs accept.
[131087580020] |(There is a standard defined for it, but it's an after-the-fact thing and is mostly ignored when one of the implementations adds new features.)
[131087580030] |Since there are multiple implementations of those (OpenSSH, F-Secure, PuTTY, etc.) occasionally you'll find that one of them doesn't support the same protocol as the others.
[131087580040] |Basically, it defines authentication negotiation and creation of a multiplexed data stream.
[131087580050] |This stream can carry one or more (with OpenSSH and ControlMaster
) terminal sessions and zero or more tunnels (forwarding socket connections from either local or remote to the other side; X11 forwarding is a special case of remote forwarding).
[131087580060] |It also defines "subsystems" that can be used over the stream; terminal sessions are the basic subsystem but others can be defined. sftp
is one of these.
[131087580070] |ssh
the utility uses the SSH protocol to talk to sshd
on another machine.
[131087580080] |How it works depends on what version it is (see above), but the gist of it is that it attempts to figure out which version of the SSH protocol to use, then it and sshd
negotiate supported authentication methods, then it tries to authenticate you using one of those methods (asking for remote user password/private key paasword/S-Key phrase as necessary), and on successful authentication sets up a multiplexed stream with the sshd
.
[131087580090] |sshd
, as said above, implements the server side of the SSH protocol.
[131087580100] |sftp
is a (at present, the only standard) subsystem defined in most sshd
implementations.
[131087580110] |When the SFTP subsystem is requested, sshd
connects sftp-server
to the subsystem session; the sftp
program then talks to it, similarly to ftp
but with file transfers multiplexed on the stream instead of using separate connections as with ftp
.
[131087580120] |su
has nothing to do with ssh
, sshd
, or sftp
, except insofar as there may be PAM modules to arrange for the multiplexed stream to be available within the shell or program run by it.
[131087590010] |30-local0.conf
:
[131087610010] |[[
command's =~
operator forces string matching, so the correct pattern for bash 4 should be:
[131087630010] |find
(e.g. GNU 4.4.0) you can use the -newermt
option.
[131087640020] |For example, to find all files that have been modified on the 2011-02-08
[131087640030] |Also note that you don't need to pipe into grep to find php files because find can do that for you in the -name
option.
[131087640040] |Take a look at this SO answer for more suggestions: How to use 'find' to search for files created on a specific date?
[131087650010] |You have almost the right command already, for versions of find
that won't let you use dates:
[131087650020] |In general, for find
-n means fewer than, n means equal, +n means "more than".
[131087650030] |Traditional find
has some exceptions, but GNU find
and other newer versions such as on BSD/Mac OS X corrected those.
[131087650040] |(Keep this in mind if you ever find yourself on a Solaris or other commercial Unix system.)
[131087660010] |Annoyingly, there isn't any direct way with standard find
.
[131087660020] |Recent versions of find
on GNU systems (e.g. non-embedded Linux, Cygwin) and some *BSDs have options such as -newermt
to compare a file date with a spelled-out date.
[131087660030] |With standard find
, all you can do is compare the file date with the current date (-mtime
) or with a fixed file.
[131087660040] |The current date is usually not useful in this case (it counts back from the time you run the find
command, whereas most applications require a calendar date).
[131087660050] |That leaves you with the kludge of creating temporary files to define a range.
[131087670010] |try()
further like so:
[131087690010] |If you really want to exit
on an error and are using Bash, then you should also consider set -e
.
[131087690020] |From help set
:
[131087690030] |-e Exit immediately if a command exits with a non-zero status.
[131087690040] |This of course doesn't give you the flexibility of a did_it_work() function, but it is an easy way to make sure your bash script stops on an error without adding lots of calls to your new function.
[131087700010] |One common way is:
[131087700020] |then you use it like this:
[131087700030] |Or if you want it to include the exit status, you could change it to:
[131087700040] |and then using it is a bit easier:
[131087700050] |Just in case you haven't seen command1 || command2
before, it runs command1
, and if command1
fails, it runs command2
.
[131087700060] |So you can read it like "make the directory or die".
[131087700070] |Your example would look like:
[131087700080] |Or you can align the dies
further on the right so that the main code is more obvious.
[131087700090] |Also, if you are going to use the name some/path
multiple times, store it in a variable so you don't have to keep typing it, and can easily change it if you need to.
[131087700100] |And if you plan to fix the problem and re-run the script, maybe you want the script to work if the directory already exists, so you don't have to remove it first, in which case, you would want
[131087710010] |tail -n
, but is there something that I can actually scroll and go from bottom up?
[131087720010] |The tac
command is like a reverse "cat", if that's what you're after.
[131087720020] |If you just want to view a file by starting at the bottom, why don't you use an editor or "less"?
[131087730010] |Some systems have tac
, which is a whimsically-named backward cat
.
[131087730020] |Without that, you can still do something like
[131087740010] |I think less +G
is what you're looking for — it'll load up the file at the end, and you can use the up arrow (or k) to scroll back.
[131087740020] |Within the viewer, g will take you to the top of the file and G will take you back to the end.
[131087740030] |And F will scroll to the end and try to keep reading, like tail -f
.
[131087750010] |If you are writing a nagios check the perl module File::ReadBackwards is useful
[131087760010] |You can run less
and then use M-> (that's the meta key, usually alt, and the '>' at the same time) to go to the bottom of the file. less
supports scrolling.
[131087770010] |/bin/sh
, which is dash and not bash on your system.
[131087790030] |Change any #!/bin/sh
line at the top of the scripts to #!/bin/bash
, and change the explicit invocations of /bin/sh
into /bin/bash
as well.
[131087790040] |The immediate source of the error on line 73 is that $username
is not set, so the [
command sees the operands ==
and root
(plus the final ]
).
[131087790050] |This is a syntax error.
[131087790060] |It's impossible to know why the variable isn't set without seeing more of the script.
[131087790070] |(Beware that the small extract from the scripts you've included in your post shows that the author doesn't have a lot of experience writing unix shell scripts.
[131087790080] |From what I've seen elsewhere, this often applies to the rest of the driver.
[131087790090] |Open-source drivers shipped in Linux distributions tend to be much better quality than manufacturer-provided drivers.
[131087790100] |Unfortunately, it looks like you have no choice with this model.)