sysadmin

How do I add a user in Ubuntu? [closed]

有些话、适合烂在心里 提交于 2019-11-29 19:11:12
Specifically, what commands do I run from the terminal? quackingduck Without a home directory sudo useradd myuser With home directory sudo useradd -m myuser Then set the password sudo passwd myuser Then set the shell sudo usermod -s /bin/bash myuser Liberty Here's the command I almost always use (adding user kevin): useradd -d /home/kevin -s /bin/bash -m kevin There's basicly 2 commands to do this... useradd adduser (which is a frendlier front end to useradd) You have to run them has root. Just read their manuals to find out how to use them. 来源: https://stackoverflow.com/questions/38288/how-do

How can I delete a service in Windows?

三世轮回 提交于 2019-11-29 18:31:57
I have a couple old services that I want to completely uninstall. How can I do this? Lasse Vågsæther Karlsen Use the SC command, like this (you need to be on a command prompt to execute the commands in this post): SC STOP shortservicename SC DELETE shortservicename Note: You need to run the command prompt as an administrator, not just logged in as the administrator, but also with administrative rights. If you get errors above about not having the necessary access rights to stop and/or delete the service, run the command prompt as an administrator. You can do this by searching for the command

What Python way would you suggest to check whois database records?

旧巷老猫 提交于 2019-11-29 13:54:54
问题 I'm trying to get a webservice up and running that actually requires to check whois databases. What I'm doing right now is ugly and I'd like to avoid it as much as I can: I call gwhois command and parse its output. Ugly. I did some search to try to find a pythonic way to do this task. Generally I got quite much nothing - this old discussion list link has a way to check if domain exist. Quite not what I was looking for... But still, it was best anwser Google gave me - everything else is just a

Is there any performance hit involved in choosing gzip over deflate for http compression?

痴心易碎 提交于 2019-11-29 13:29:14
We recently switched some of our sites from deflate to gzip and noticed a significant increase in cpu load on our servers. Is it possible that you are experiencing cache miss? That is, compressed content is sometimes cached compressed but switching compression schemes would (or at least should) invalidate that cache causing dramatically increased cpu utilization. Did you try switching it back? Gorpik gzip is, basically, deflate with some additional headers. So there should not be a significant performance hit. Now, maybe your deflate tool is just more efficient than your gzip tool. Are you

How to install libpython2.7.so

让人想犯罪 __ 提交于 2019-11-29 12:32:40
问题 I have installed Python 2.6.6 at [17:50:21 root@data.dev:~]# which python /usr/local/bin/python also Python 2.7.6 at [17:51:12 root@data.dev:~]# which python2.7 /usr/local/bin/python2.7 But libpython2.7.so is missing [17:48:52 root@data.dev:~]# locate libpython2.6.so /usr/lib64/libpython2.6.so /usr/lib64/libpython2.6.so.1.0 /usr/lib64/python2.6/config/libpython2.6.so [17:48:56 root@data.dev:~]# locate libpython2.7.so [17:49:02 root@data.dev:~]# Dont know how to fix this. can anyone help ? 回答1

Proper way to run a script using cron?

此生再无相见时 提交于 2019-11-29 11:46:19
When running a script with cron, any executable called inside must have the full path. I discovered this trying to run wondershaper , when many errors showed when it tried to call tc. So my question is, what's the proper way to overcome this problem? Possible solutions: cd to the executable folder and prepare symbolic links to any other called executable there (not sure if it works - low portability) use full paths in the script (it works - low portability across different distros) exporting a path variable with the needed paths inside the script (not sure if it works) Well, thanks in advance

Monitor a set of files for changes and execute a command on them when they do

蓝咒 提交于 2019-11-29 08:01:22
The (command line) interface I have in mind is like so: watching FILE+ do COMMAND [ARGS] (and COMMAND [ARGS])* Where any occurrence of " {} " in COMMAND is replaced with the name of the file that changed. And note that " do " and " and " are keywords. For example: > watching foo.txt bar.txt do scp {} somewhere.com:. and echo moved {} to somewhere Or: > watching foo.c do gcc foo.c and ./a.out I'm not wedded to that interface though. I'll add my script that does that as an answer and see if anyone has anything better or ways to improve it. #!/usr/bin/perl # Run some commands whenever any of a

PowerShell Script to Get a Directory Total Size

99封情书 提交于 2019-11-29 01:24:21
I need to get the size of a directory, recursively. I have to do this every month so I want to make a PowerShell script to do it. How can I do it? JaredPar Try the following function Get-DirectorySize() { param ([string]$root = $(resolve-path .)) gci -re $root | ?{ -not $_.PSIsContainer } | measure-object -sum -property Length } This actually produces a bit of a summary object which will include the Count of items. You can just grab the Sum property though and that will be the sum of the lengths $sum = (Get-DirectorySize "Some\File\Path").Sum EDIT Why does this work? Let's break it down by

Free DNS server for Windows XP/Vista/Win7? [closed]

半城伤御伤魂 提交于 2019-11-28 18:49:33
问题 I'm currently developing a security solution that should work across domains and as such I need a small private dns server to add various entries to. I could alter the hosts file to achieve the same result but since the hosts file doesn't support wildcard chars I will have a whole lot of entries, so a DNS server that supports wildcards would be a little bit easier. Any suggestions? 回答1: As a reference: http://sourceforge.net/projects/acrylic/ Acrylic is a local DNS proxy which improves the

Run a linux system command as a superuser, using a python script

大兔子大兔子 提交于 2019-11-28 17:58:06
I have got postfix installed on my machine and I am updating virtual_alias on the fly programmatically(using python)(on some action). Once I update the entry in the /etc/postfix/virtual_alias, I am running the command: sudo /usr/sbin/postmap /etc/postfix/virtual_alias 2>>/work/postfix_valias_errorfile But I am getting the error: sudo: sorry, you must have a tty to run sudo I want to run the mentioned sudo command in a non-human way(meaning, I am running this system command from a python script.). So how do I get this command run programmatically? You can either run your python script as root