Tag Info

Hot answers tagged

14

Not sure there is an answer to this when using a mouse. If you wanted a command-line way to do it, you can just echo the command and pipe that output to clip: echo stuff you wanted copied to the clipboard | clip FYI, clip is available on Windows 2003. I believe it is a built-in.


10

If you're not too fussy about the appearance of the separator: tail -n +1 *


10

Question is already answered on stackoverflow: http://stackoverflow.com/questions/274560/how-do-you-test-a-public-private-keypair (Can I mark a question as duplicate on another stackexchange network?) I would prefer the ssh-keygen -y -f <private key> way instead of the accepted answer on SO. ssh-keygen -y -f <private key> takes a private key ...


9

You can prepend the current directory: cd ./-


7

Rephrasing the question, you want to know when someone attempts to set the system time. This is exactly what the audit subsystem is for...it allows you to audit the execution of specific system calls. In this case, you want to know whenever someone calls any of the various system calls that can change the system time. By using the audit subsystem, you ...


7

The server has been hacked. Google "opyum team." Take server offline ASAP and restore from known-good backups.


7

You can import (execute) an SQL file using the following command: $ mysql -u user -p mydb < dump.sql If you exported your data using some tool other than mysqldump, you may have troubles restoring your dump file. I ran into such a problem when I exported the database using phpmyadmin and imported it using the command line. To export your database, you ...


7

If the allowed command set includes the sftp daemon (or internal-sftp), then SFTP would be allowed. However, if you're setting the forced command in the authorized_keys file and the user had sftp access, without additional work they could replace the file with one not restricted to what you define. This would of course work with any application that the user ...


7

Are you referring to nginx_ensite and nginx_dissite?


6

You could always try doing 310 minutes instead.


6

There's no point in re-sourceing a new .bashrc within Puppet, because it'll run in a subshell and the changes won't propagate into your current shell (which is, I assume, what you're trying to do). You can't do what (I think) you want to do.


6

Root is root. Anything you do to try to keep track of root usage can be subverted or circumvented by someone who has root; even if you cause bash to pipe all history file entries to syslog on a secured remote server, for example, your system is only safe until the badly-behaved user figures out what you've done and disables or works around it. This is a ...


5

cd /to/your/directory; for each in *; do cat $each; echo "XXXXXXXXXXX"; done


5

The following prevents locked-down accounts from changing their shells, and selectively lets people use chsh themselves WITHOUT sudo or su: Simple setup that is still secure: Add this very top of /etc/pam.d/chsh: # This allows users of group chsh to change their shells without a password. # # Per: ...


5

awk 'FNR==1 && NR!=1 {print "XXXXXXXXXXXX"}{print}' * Or awk 'FNR==1 {print "XXXXXX" FILENAME "XXXXXX"}{print}' * Or awk 'FNR==1 {print "XXXXXX File no. " ++count "XXXXXX"}{print}' * Using only Bash (no cat): for file in *; do printf "$(<"$file")\nXXXXXXXXXXXX\n"; done


5

You can use at: $ at 10am Jul 31 2030 warning: commands will be executed using /bin/sh at> echo Hello at> <EOT> job 2 at Wed Jul 31 10:00:00 2030 $ atq 1 Sun Jul 31 10:00:00 2030 a user $ atrm 1


5

Any computer system which will be running sufficiently unmodified, after four years, that a script remains valid without modificaiton is somewhat static. Any scheduling system which assumes that one box will still be serving the same role so much later is rather optimistic. Hard disk failure or other problems would make it likely that you get to discover ...


5

I noticed a subtle difference between the command posted: echo $(id -un) and the error message for it: id: –un: No such user The two "hyphens" are different, the second one being a tiny bit longer. It looks like the error message was copied and pasted from the original, but the command was re-typed. The original command most likely contains the wrong ...


4

You will not find the binary executable, because source is a built-in Bash command. Why would you need the binary anyway?


4

The commands sudo su; su tomcat are two commands. The shell will run the first and when it completes it will run the second. Note that the shell does not pass the second command as an argument to the first command. When you exit the first command it will run the second sudo su ; su tomcat [sudo] password for iain: root@host:iain]$ exit exit Password: ...


4

When you divide your sudo and su commands with a ; sign the su will be executed after the sudo has finished. I.e. in that case you execute the su as your normal user. To achieve your desired result try to execute the whole in one command: sudo su - tomcat


4

rsync is a program designed to be a client and server. The server reads and the client writes. Imagine that instead of a single computer, you had computers over network, I'm sure it's lot more clear if you think that way. Then there is the controller. As IO operations tend to come with certain amount of risk, an IO issue shouldn't cause total blocking or a ...


4

The forfiles command can select files based on their ages, so something like this could be used to delete log files 7 or more days old: forfiles /d -7 /c "cmd /c echo @file" To save a monthly copy, use the task scheduler to copy that file to an archive folder once a month.


4

man kill If sig is 0, then no signal is sent, but error checking is still performed; this can be used to check for the existence of a process ID or process group ID. killall kill processes by name instead of PID.


4

lpr works great on the Mac. If you type "lpr foo.txt" on my MacBook Pro, it gets sent to my default printer. Make sure that you have a printer setup. Update: I asked a few of the Mac guys in the office about this and they indicated that in the past, some low-end "Win-Printers" with Mac drivers were unable to actually process plain text coming from LPR. ...


4

The most common threat comes from allowing them to use a command is capable of doing things the admin hadn't thought about. For example, CVS and SVN allow for pre/post commit scripts to run. If a user can modify a post-commit script, he can run his own commands.


4

You can't easily prevent a user from running his own version of program, but if you assume that the user is not malicious it is easy: Create a wrapper script that logs the program and then runs it (using the original parameters) Make sure the wrapper replaces the original program in the user path. You can either use alias to make the users use the ...


4

This is the "birth" time of a specific file - the moment when it was created on the file system. This attribute is new to ext4 and is also known as crtime or btime, just google it. :) Here you can find a discussion regarding the stat command and the specific output you're seeing.


3

Technically, you could use: exec { "root_bashrc": command => "bash -c 'source /root/.bashrc'", subscribe => File["/root/.bashrc"], refreshonly => true, } However, as @womble already pointed out, there's no point in sourcing .bashrc like that; it only affects the bash shell that's run in that command, not any currently running ...


3

You should definitely use Maintenance Plan functionality to do your backups. You can easily configure it to create new backup file for each run (it will append full date & time to the end of file name, e.g. mydb_backup_201106080006.bak). One of the possible tasks of Maintenance plan is Maintenance Cleanup Task that is used to delete unwanted *.bak & ...



Only top voted, non community-wiki answers of a minimum length are eligible