Tag Info

Hot answers tagged

80

$ sudo apt-get install sshpass $ sshpass -p your_password ssh user@hostname


64

Don't use a password. Generate a passphraseless SSH key and push it to your VM. If you already have an SSH key, you can skip this step… Just hit Enter for the key and both passphrases: $ ssh-keygen -t rsa -b 2048 Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa): Enter passphrase (empty for no ...


52

Don't bother with uninstalling or fixing bloatware. Just reimage the computers. In fact it's pretty easy to setup a reference image, sysprep, capture, and deploy it using WDS + MDT. See the aforementioned for various driver packages: trust me you're not the first person to think of this stuff, it's been solved already. Profiles can be transferred with USMT. ...


29

monitoring+alerting - which is great safety net. just as developers write unit tests to make sure things don't get messed up when they update code, i rely on monitoring as additional safety net just in case i screw something up [ that is disconnect a server, deny production traffic on firewall etc ]. it gives a peace of mind - if things break i will know ...


25

For me, it has been centralized authentication. I got to the point that I was administering 40 or so Slackware machines, and each one had local authentication PLUS local Samba authentication. I also had a VPN solution where each account needed to be setup, plus an internal jabber server and an internal email server. Everything had its own account. MAC ...


23

I wrote a program to block IP addresses like you're asking for a couple of years ago, but did it for a Customer as a work-for-hire. Since I ended up with some "spare" time this evening I opted to re-implement the whole thing from the ground up, write some useful documentation, and generally make it a presentable program. Since I've heard from multiple people ...


20

Puppet sounds perfect for what you're trying to do, with the caveat that as of right now, there is no support for Windows. In your case, you would define a Server node in terms of all of the packages that are identical across the machines. Then, you define the individual hosts as nodes which inherit from Server, and set up the specific unique things for it. ...


20

• How does a sysadmin improve their shell scripting? Practice, mixed with drive. It sounds trite, but you have to want to get better, in addition to practice. If you don't truly enjoy scripting, you can be forced to do it for years when you have to and never really get good at it. If you don't want to get better, you could sit next to the best ...


19

I agree with the obvious choices here; Automation and central authentication. However, it appears that I have to be the guy to mention documentation. By documenting as many problems, workflows, installations and guides as possible people were able to work through some of their issues without the need to get our department on it. Another great time saver is ...


16

Multiple monitors, with a window open on the console of each server I was responsible for.


16

Infrastructure automation with a tool like Chef or Puppet is the best thing I've implemented on systems I manage. Monitoring is great and all, but often, getting the various bits to play nice with the rest of the infrastructure requires a lot of work. Chef and Puppet are both great at automating the entire infrastructure, providing a lot of glue that used to ...


14

Add a ; /bin/bash to the end of your command line on the remote side? That is: spawn ssh -t root@marlboro "cd /tmp; ls -altr | tail; /bin/bash -i" Even better, change root's .bashrc to be something like this: PROMPT_COMMAND="cd /tmp && ls -altr | tail ; unset PROMPT_COMMAND" :)


13

You can use pre-seeding for this, using the debconf-set-selections command to pre-answer the questions asked by debconf before installing the package. For example: debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" apt-get ...


12

Easy answer in three easy steps Generate a rsa keypair: # ssh-keygen then copy it on the server with one simple command: # ssh-copy-id hostname you can now log in without password: # ssh hostname


11

There are many ways that would help: remove the complete home directory and copy all files from /etc/skel back to the homedir. Change permissions afterwards. put the system in a virtual machine, make a snapshot and revert to the snapshot after lesson 1 find something like a kiosk mode in RHEL. Ubuntu has something like that, which automatically restores ...


10

Use expect: #!/usr/bin/expect -f # ./ssh.exp password 192.168.1.11 id set pass [lrange $argv 0 0] set server [lrange $argv 1 1] set name [lrange $argv 2 2] spawn ssh $name@$server match_max 100000 expect "*?assword:*" send -- "$pass\r" send -- "\r" interact Example: # ./1.ex password localhost ooshro spawn ssh ooshro@localhost ooshro@localhost's ...


10

Sure you don't want to use SSH keys rather than passwords? That way it's both secure and automatic.


10

For Windows 7, I've broken this down into smaller chunks so that I have more control. This assumes that you have a directory structure like this and that you download the .msu updates from Microsoft to the updates folder: c:\ - Win7 --- mount --- updates --- stagedupdates You can obviously modify this to your liking. I also manually download the ...


10

I believe, ultimately, the correct answer is "Fix your application". However, you may not be able to for any number of reasons. That being said... Which version of Windows? In Vista/2008 and up, you can tie Scheduled Tasks to specific Event IDs. In the System event log, Event ID 19 from WindowsUpdateClient, indicates successful WUA Update ...


10

First of all, don't just take my word for it! Test my suggestion out with this: select CONCAT('alter table ',TABLE_SCHEMA,'.',TABLE_NAME,' charset=utf8;') from information_schema.TABLES WHERE TABLE_SCHEMA != 'information_schema' limit 10; select CONCAT('alter table ',TABLE_SCHEMA,'.',TABLE_NAME,' alter column ',COLUMN_NAME,' charset=utf8;') from ...


9

We use Cobbler and Puppet for build and configuration automation of both real and virtual machines. Cobbler ties together DHCP, PXE boot and Kickstart to make deployment nothing more than adding a machine profile and hitting the power button. For VMs, the koan command does the (in our case) Xen magic to get the installation started -- on the dom0 I just ...


9

If you want this globally: dpkg-reconfigure debconf Then configure it to be "noninteractive" If you just want it for single install run: DEBIAN_FRONTEND=noninteractive apt-get install PACKAGE


9

Without installing ii: echo -e 'USER bot guest tolmoon tolsun\nNICK bot\nJOIN #channel\nPRIVMSG #channel :Ahoj lidi!\nQUIT\n' \ | nc irc.freenode.net 6667


9

The way we do this is to use a kickstart/preseed file to install & configure Puppet on our servers during the OS install. Then as long as you've preconfigured your Puppet manifest to do all your initial tasks, it'll happen automatically.


9

You could use cron and the @reboot flag to schedule the shutdown if you add this to the root crontab: @reboot shutdown -h +30


9

I have the benefit of understanding the size and complexity of your environment. Seeing as you work for a cloud/hosting provider, it's safe to assume that you have a large number of small-medium sized environments (10-100 servers). There are certainly daily tasks that are done by the jr. engineers and NOC staff that are repetitive (creating user accounts, ...


8

This might not be any use to you, but you can do it with Perl: #!/usr/bin/perl use warnings; use strict; use Net::SSH::Perl; my $host = 'remote.serv.er'; my $user = 'root'; my $pass = 'hunter2'; my $ssh = Net::SSH::Perl->new('$host'); $ssh->login('$user', '$pass') or die "Oh noes! $!";


8

Before doing any of this make sure you are familiar with the freebsd-update process, possible ramifications, and requirements. Like any automated update there is a chance it will screw up. Create the file /usr/local/etc/periodic/weekly/912.freebsd-update with the following: #!/bin/sh - # # # If there is a global system configuration file, suck it in. # if ...


8

There exists a more direct command called pkill. Usage is as follows: $ pkill "process name here"


7

As long as you control the client, you could use FTPFS on the client, then rsync the local directory to the apparently-local-but-really-mounted-via FTPFS directory. I understand that FTPFS is now part of LUFS. Edit: I'd love to link to a tutorial, but I normally just start with the project wiki, and something seems to be up with sourceforge right now. ...



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