source_id
int64 1
4.64M
| question
stringlengths 0
28.4k
| response
stringlengths 0
28.8k
| metadata
dict |
---|---|---|---|
176,747 | how can i restart rsyslog or rsyslogd on ubuntu 10 root@terminator:/etc/init.d# service rsyslog status
rsyslog stop/waiting
root@terminator:/etc/init.d# service rsyslog stop
stop: Unknown instance:
root@terminator:/etc/init.d# service rsyslog restart
restart: Unknown instance:
root@terminator:/etc/init.d# service rsyslog start
start: Job failed to start
root@terminator:/etc/init.d# service rsyslogd start
rsyslogd: unrecognized service | sudo service rsyslog restart That should do it. | {
"source": [
"https://serverfault.com/questions/176747",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
176,935 | As I know, newly running shell script inherits it's environment variables.
Is there a way to block this? (running shell without variable inheriting) | It seems you can prefix your script with env -i which will clear the environment before running the script: env -i sh test.sh From man env : -i, --ignore-environment
start with an empty environment Not sure why you would want to do this though... | {
"source": [
"https://serverfault.com/questions/176935",
"https://serverfault.com",
"https://serverfault.com/users/46527/"
]
} |
177,461 | I'm able to use limit_req to rate-limit all requests to my server. However I'd like to remove the rate restriction for certain IP addresses (i.e. whitelist) and use a different rate restriction for certain others (i.e. certain IPs I'd like as low as 1r/s). I tried using conditionals (e.g. if ( $remote_addr = "1.2.3.4" ) {} ) but that seems to work only with rewrite rules, not for rate-limit rules. | It is really better to avoid using the "if" directive. When the key in limit_req_zone (and limit_conn_zone) is empty the limits are not applied. You can use this in conjunction with the map and geo modules to create a whitelist of IPs where the throttle limits are not applied. This example shows how to configure a limit for both concurrent requests and request rate from a single IP. http {
geo $whitelist {
default 0;
# CIDR in the list below are not limited
1.2.3.0/24 1;
9.10.11.12/32 1;
127.0.0.1/32 1;
}
map $whitelist $limit {
0 $binary_remote_addr;
1 "";
}
# The directives below limit concurrent connections from a
# non-whitelisted IP address to five
limit_conn_zone $limit zone=connlimit:10m;
limit_conn connlimit 5;
limit_conn_log_level warn; # logging level when threshold exceeded
limit_conn_status 503; # the error code to return
# The code below limits the number requests from a non-whitelisted IP
# to one every two seconds with up to 3 requests per IP delayed
# until the average time between responses reaches the threshold.
# Further requests over and above this limit will result
# in an immediate 503 error.
limit_req_zone $limit zone=one:10m rate=30r/m;
limit_req zone=one burst=3;
limit_req_log_level warn;
limit_req_status 503; The zone directives must be placed at the http level, however the other directives can be placed further down, e.g. at the server or the location level to limit their scope or further tailor the limits. For futher information refer to the Nginx documentation ngx_http_limit_req_module and ngx_http_limit_conn_module | {
"source": [
"https://serverfault.com/questions/177461",
"https://serverfault.com",
"https://serverfault.com/users/12271/"
]
} |
177,952 | We recently went through a hurricane and our server room became flooded. Hooray for insurance. Anyway, I need to save as much data off one of the hard drives as possible. Yes, it was submerged for the better part of two days. Do I need to open the drive and make sure it's flood-water free? Should I remove the board on bottom and dry out the foam? What all do I need. Any suggestions would be helpful. Thanks in advance! | http://www.storagesearch.com/disklabs-art3-floods.html Do NOT attempt to recover the data
yourself. This will do more damage to
your data and makes it more difficult
to recover when it eventually gets to
a data recovery specialist. When hard disk drives get wet, the
'heads' can get stuck to the platters.
When the hard drive is powered up in
this state the disk tries to spin up
and the heads literally get ripped off
causing damage to the platters - the
place where all the data is stored. 2
- Do NOT DRY the hard disk drive out. Although this may seem paradoxical -
this will nearly always destroy the
platter of the hard disk thus making
your data irretrievable. When hard disk drives get wet then dry
out, there is nearly always a residue
of contaminant left on the platters
and heads. Any residue (including a
piece of dust), causes physical
degradation of the hard disk's
platters and loses more data. 3 - DO
keep the hard disk WET. Ideally, keep
the hard disk drive in a sealed
container to keep the hard disk drive
wet. This stops the hard disk drive
corroding and allows the technical
staff at the recovery company to clean
and dry the platters correctly with
minimum damage to the platter
surfaces. Normally, Disklabs Data Recovery
charges a premium for water damaged
hard disk drives, however, this
additional charge for the cleaning and
drying out of the hard disk drive has
been waivered for the victims of the
latest flooding events. | {
"source": [
"https://serverfault.com/questions/177952",
"https://serverfault.com",
"https://serverfault.com/users/31199/"
]
} |
178,021 | Last time I tried to register a domain of 2 characters it told me it had to be of more than 2 characters. How is it possible that paypal has http://x.com Is there a special way to go about this? obviously - a.com - b.com c.com are not taken(else cyber squatters would have been sitting on it since the early 90's) Do you know how this works? | It was purchased before 1993 by Weinstein & DePaolis, and subsequently sold to Paypal (or the company was bought out). In 1993 IANA reserved all remaining single letter second-level domains, and grandfathered the ones already issued. Other functional, corporate examples domains are t.co (Twitter) and q.com (Qwest). I hate to cite Wikipedia as a source, but it has an acceptable article on Single-letter second-level domains : On December 1, 1993, the Internet Assigned Numbers Authority (IANA) explicitly reserved the remaining single-letter and single-digit domain names. The few domains that were already assigned were grandfathered in and continued to exist. The assigned domains in this group are the following: i.net INet Solutions Ltd Future Media Architects
q.com JG Qwest
q.net Privately owned Privately owned
x.com Weinstein & DePaolis PayPal
x.org The Open Group X.Org Foundation
z.com HomePage.com Nissan Motors As of April 2009 only three domains, i.net, x.com and x.org host a web site. q.com is active but redirects to qwest.com. | {
"source": [
"https://serverfault.com/questions/178021",
"https://serverfault.com",
"https://serverfault.com/users/39151/"
]
} |
178,080 | a while ago I gave root a password so I could log in as root and get some stuff done. Now I want to disable root login to tighten security, since I'm going to be exposing my serve to the internet. I've seen several ways of doing this ( sudo passwd -l root , fiddling with /etc/shadow , and so on), but nowhere that says what the best/most sensible way of doing it is. I've done sudo passwd -l root but I've seen advice that says this can affect init scripts, and that it's not as secure as it looks since it still asks for a password if you try to log in, rather than flat out denying access. So what would be the way to achieve that? EDIT: to clarify, this is for local login as root; I've already disabled remote login via SSH. Though trying to log in as root over SSH still prompts for root's password (which always fails). Is that bad? | It's debatable, to me, that disabling root is worth the potential issues. I have never tested a server configured in such a manner. My preference is to allow root local access only. If an attacker has physical access to your server, you can forget everything you've done to "secure" your install anyway. Disable root ssh access by editing /etc/ssh/sshd_config to contain: PermitRootLogin no Fiddling with /etc/shadow , chsh -s /bin/false root all can be undone with a simple bootable CD/thumbdrive. Update per your comment: From help.ubuntu.com : "By default, the root account password is locked in Ubuntu ". Please see the section "Re-disabling your root account" specifically. In order to reset the state of root's account, to install-default, use the following command: sudo usermod -p '!' root | {
"source": [
"https://serverfault.com/questions/178080",
"https://serverfault.com",
"https://serverfault.com/users/13642/"
]
} |
178,457 | I have a long-running server process inside a screen session on my Linux server. It's a bit unstable (and sadly not my software so I can't fix that!), so I want to script a nightly restart of the process to help stability. The only way to make it do a graceful shutdown is to go to the screen process, switch to the window it's running in, and enter the string "stop" on its control console. Are there any smart redirection contortions I can do to make a cronjob send that stop command at a fixed time every day? | This answer doesn't solve the problem, but it's left here because 30+ people found it useful , otherwise I would have deleted it long time ago. Write to /proc/*pid of the program*/fd/0 . The fd subdirectory contains the descriptors of all the opened files and file descriptor 0 is the standard input (1 is stdout and 2 is stderr). You can use this to output messages on the tty where a program is running, though it does not allow you to write to the program itself. Example Terminal 1: [ciupicri@hermes ~]$ cat
shows on the tty but bypasses cat Terminal 2: [ciupicri@hermes ~]$ pidof cat
7417
[ciupicri@hermes ~]$ echo "shows on the tty but bypasses cat" > /proc/7417/fd/0 | {
"source": [
"https://serverfault.com/questions/178457",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
178,469 | Normally, when you load a saved session in PuTTY and connect to it, PuTTY will set the window title to the host name of the system you connected to (plus the string "PuTTY"). Now I have many different sessions that all connect to the same host, but on different ports (because the host runs several SSH tunnels on different ports). Therefore seeing the host name is not very helpful, since it's always the same. So I'd like PuTTY to show the name of the loaded session in the window title. Is there a way to do this? The only way I could find is to set the window title manually (Window / Behaviour / Window title). But I believe I'd have to do this manually for each session, which is rather tedious. | The solution below seems to solve this problem. 1) Go to the aforementioned Window/Behaviour/Window Title setting and
put in a title that makes sense to you. 2) Go to the Terminal/Features settings and check off the Disable
remote-controlled window title changing box. | {
"source": [
"https://serverfault.com/questions/178469",
"https://serverfault.com",
"https://serverfault.com/users/2439/"
]
} |
178,476 | On the client: # cf-agent -KIv
...
cf3 -> Handling file existence constraints on /etc/cfengine3
cf3 -> Copy file /etc/cfengine3 from /srv/cfengine/sysconf/server/inputs check
cf3 No existing connection to 172.31.69.83 is established...
cf3 Set cfengine port number to 5308 = 5308
cf3 -> Connect to 172.31.69.83 = 172.31.69.83 on port 5308
cf3 LastSaw host 172.31.69.83 now
cf3 Loaded /var/lib/cfengine3/ppkeys/root-172.31.69.83.pub
cf3 .....................[.h.a.i.l.].................................
cf3 Strong authentication of server=172.31.69.83 connection confirmed
cf3 Server returned error: Unspecified server refusal (see verbose server output)
cf3 Can't stat /srv/cfengine/sysconf/server/inputs in files.copyfrom promise
cf3 ?> defining promise result class Cfengine_Inputs_Updated_Failed
....
cf3 .........................................................
cf3 Promise handle:
cf3 Promise made by: [cf-agent.cf ] FAILED 172.31.69.83:///srv/cfengine/sysconf/server/inputs -> localhost:///etc/cfengine3 However, on the server (172.31.69.83), there's no reason why it can't stat the directory: cyrus:/srv/cfengine/sysconf/server# ls -l /srv/cfengine/sysconf/server/inputs
total 52
-rw-r--r-- 1 root root 2142 Sep 6 21:54 cf-agent.cf
-rw-r--r-- 1 root root 831 Sep 6 18:31 cf-execd.cf
-rw-r--r-- 1 root root 4517 Sep 6 21:44 cf-serverd.cf
-rw-r--r-- 1 root root 3082 Sep 6 21:44 dns.cf
-rw-r--r-- 1 root root 2028 Sep 6 15:12 failsafe.cf
-rw-r--r-- 1 root root 5966 Sep 6 21:44 ldap-masters.cf
-rw-r--r-- 1 root root 4380 Sep 6 18:31 ldap-security.cf
-rw-r--r-- 1 root root 2735 Sep 6 08:21 lib-core.cf
-rw-r--r-- 1 root root 1506 Sep 6 21:45 lib-utils.cf
-rw-r--r-- 1 root root 2635 Sep 6 20:27 lib-vars.cf
-rw-r--r-- 1 root root 2057 Sep 3 17:46 nss.cf
-rw-r--r-- 1 root root 1472 Sep 6 18:31 packages.cf
-rw-r--r-- 1 root root 1257 Sep 6 18:01 pam-security.cf
-rw-r--r-- 1 root root 4019 Sep 6 19:32 promises.cf
-rw-r--r-- 1 root root 2808 Sep 3 17:22 site.cf
-rw-r--r-- 1 root root 1670 Sep 6 18:31 sudo-security.cf
-rw-r--r-- 1 root root 831 Sep 6 18:31 sys-security.cf
-rw-r--r-- 1 root root 890 Sep 6 18:31 sys-users.cf
cyrus:/srv/cfengine/sysconf/server# I don't see anything interesting server side either when running: /usr/sbin/cf-serverd -d4 --verbose --no-fork And the following does not have any complaints: /usr/sbin/cf-promises -v Any ideas? I'm running cfengine3 on debian, v3.0.5+dfsg-1 - and the cf-agent.cf file is as follows: bundle agent Update {
files:
linux::
"${cf3.path[inputs]}"
action => immediate,
move_obstructions => "true",
depth_search => Recursive,
copy_from => MirrorFrom(
"${cf3.host[server]}",
"${cf3.path[scm-inputs]}",
"true",
"0400"
),
classes => DefineSoftClass("Cfengine_Inputs_Updated")
;
"${cf3.path[sbin]}"
comment => "Setting cf3 client sbin scripts: ${cf3.path[sbin]}/",
action => immediate,
depth_search => Recursive,
copy_from => MirrorFrom(
"${cf3.host[server]}",
"${cf3.path[scm-cnt-scripts]}",
"false",
"0555"
)
;
reports:
Cfengine_Inputs_Updated::
"[cf-agent.cf ] Services:CFAgent:Inputs:Updated";
Cfengine_Inputs_Updated_Failed::
"[cf-agent.cf ] FAILED ${cf3.host[server]}://${cf3.path[scm-inputs]} -> localhost://${cf3.path[inputs]}";
} I lie, there is something interesting with a little more debugging... AccessControl(/srv/cfengine/sysconf/server/inputs)
AccessControl, match(/srv/cfengine/sysconf/server/inputs,client.com.au) encrypt request=1
Examining rule in access list (/srv/cfengine/sysconf/server/inputs,/home/cfengine)?
cf3 Host client.com.au denied access to /srv/cfengine/sysconf/server/inputs
Unappending Host client.com.au denied access to /srv/cfengine/sysconf/server/inputs
cf3 Access control in sync
Unappending Access control in sync
Transaction Send[t 59][Packed text]
Attempting to send 67 bytes
SendSocketStream, sent 67
cf3 From (host=client.com.au,user=root,ip=172.31.69.3)
Unappending From (host=client.com.au,user=root,ip=172.31.69.3)
cf3 REFUSAL of request from connecting host: (SYNCH 1283777156 STAT /srv/cfengine/sysconf/server/inputs)
Unappending REFUSAL of request from connecting host: (SYNCH 1283777156 STAT /srv/cfengine/sysconf/server/inputs)
RecvSocketStream(8)
cf3 -> Accepting a connection I'll keep looking. | The solution below seems to solve this problem. 1) Go to the aforementioned Window/Behaviour/Window Title setting and
put in a title that makes sense to you. 2) Go to the Terminal/Features settings and check off the Disable
remote-controlled window title changing box. | {
"source": [
"https://serverfault.com/questions/178476",
"https://serverfault.com",
"https://serverfault.com/users/3505/"
]
} |
178,561 | This is a technical deep dive after this overview question was asked. What are the protocol differences between SSL and TLS? Is there really enough of a difference to warrant a name change? (versus calling it "SSLv4" or SSLv5 for the newer versions of TLS) | SSLv2 and SSLv3 are completely different (and both are now considered insecure). SSLv3 and TLSv1.0 are very similar, but have a few differences. You could consider TLSv1.0 as SSLv3.1 (in fact that's what happens within the records exchanged). It's just easier to compare the TLSv1.0 with TLSv1.1 and TLSv1.2 because they've all been edited within IETF and follow more or less the same structure. SSLv3 being edited by a different institution (Netscape), it makes it a bit more difficult to spot the differences. Here are a few differences, but I doubt I can list them all: In the ClientHello message (first message sent by the client, to initiate the handshake), the version is {3,0} for SSLv3, {3,1} for TLSv1.0 and {3,2} for TLSv1.1. The ClientKeyExchange differs. The MAC/HMAC differs (TLS uses HMAC whereas SSL uses an earlier version of HMAC). The key derivation differs. The client application data can be sent straight after sending the SSL/TLS Finished message in SSLv3. In TLSv1, it must wait for the server's Finished message. The list of cipher suites differ (and some of them have been renamed from SSL_* to TLS_* , keeping the same id number). There are also differences regarding the new re-negotiation extension . I would strongly recommend Eric Rescorla's book - SSL and TLS: Designing and Building Secure Systems , Addison-Wesley, 2001 ISBN 0-201-61598-3 , if you really want more details. I've learnt about some of the points mentioned above from this book. The author occasionally mentions the differences between SSLv3 and TLS (v1.0 only at the time the book was written) when explaining some of the SSL/TLS message, but you do need the background explanation about these messages to have a chance to understand (and it's not appropriate to copy/paste from this book here). | {
"source": [
"https://serverfault.com/questions/178561",
"https://serverfault.com",
"https://serverfault.com/users/51457/"
]
} |
178,671 | After debugging for 6-hours - I am giving this up :| We have a nginx+php-fpm+mysql in LAN with almost 100 wordpress (created and used by different designers/developers all working on test wordpres setup) We are using nginx without any issues from long. Today, all of a sudden - nginx started returning "504 Gateway Time-out" out of the blue... I checked nginx error log for a virtual host... 2010/09/06 21:24:24 [error] 12909#0: *349 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 21:25:11 [error] 12909#0: *349 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 21:25:11 [error] 12909#0: *443 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 21:25:12 [error] 12909#0: *443 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 22:08:32 [error] 12909#0: *1025 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 22:09:33 [error] 12909#0: *1025 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 22:09:40 [error] 12909#0: *1064 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 22:09:40 [error] 12909#0: *1064 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 22:24:44 [error] 12909#0: *1313 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 22:24:53 [error] 12909#0: *1313 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info" As I run php-fpm on port 9000 via TCP mode, I ran "netstat | grep 9000" and noticed something unusual... (Pasting partial output here for ease of read) tcp 9 0 localhost:9000 localhost:36094 CLOSE_WAIT 14269/php5-fpm
tcp 0 0 localhost:46664 localhost:9000 FIN_WAIT2 -
tcp 1257 0 localhost:9000 localhost:36135 CLOSE_WAIT -
tcp 1257 0 localhost:9000 localhost:36125 CLOSE_WAIT -
tcp 9 0 localhost:9000 localhost:36102 CLOSE_WAIT 14268/php5-fpm
tcp 0 0 localhost:46662 localhost:9000 FIN_WAIT2 -
tcp 745 0 localhost:9000 localhost:46644 CLOSE_WAIT -
tcp 0 0 localhost:46658 localhost:9000 FIN_WAIT2 -
tcp 1265 0 localhost:9000 localhost:46607 CLOSE_WAIT -
tcp 0 0 localhost:46672 localhost:9000 ESTABLISHED 12909/nginx: worker
tcp 1257 0 localhost:9000 localhost:36119 CLOSE_WAIT -
tcp 1265 0 localhost:9000 localhost:46613 CLOSE_WAIT -
tcp 0 0 localhost:46646 localhost:9000 FIN_WAIT2 -
tcp 1257 0 localhost:9000 localhost:36137 CLOSE_WAIT -
tcp 0 0 localhost:46670 localhost:9000 ESTABLISHED 12909/nginx: worker
tcp 1265 0 localhost:9000 localhost:46619 CLOSE_WAIT -
tcp 1336 0 localhost:9000 localhost:46668 ESTABLISHED -
tcp 0 0 localhost:46648 localhost:9000 FIN_WAIT2 -
tcp 1336 0 localhost:9000 localhost:46670 ESTABLISHED -
tcp 9 0 localhost:9000 localhost:36108 CLOSE_WAIT 14274/php5-fpm
tcp 1336 0 localhost:9000 localhost:46684 ESTABLISHED -
tcp 0 0 localhost:46674 localhost:9000 ESTABLISHED 12909/nginx: worker
tcp 1336 0 localhost:9000 localhost:46666 ESTABLISHED -
tcp 1257 0 localhost:9000 localhost:46648 CLOSE_WAIT -
tcp 1336 0 localhost:9000 localhost:46678 ESTABLISHED -
tcp 0 0 localhost:46668 localhost:9000 ESTABLISHED 12909/nginx: wo There are plenty of "CLOSE_WAIT" & "FIN_WAIT2" pairs as highlighted below (in above output): tcp 1337 0 localhost:9000 localhost:46680 CLOSE_WAIT -
tcp 0 0 localhost:46680 localhost:9000 FIN_WAIT2 - Please note port 46680 in above. I enabled mysql slow queries error log, but it didn't work. As of now restarting php5-fpm every minute via a cronjob (see command below) keeping everything running "smoothly" but I hate patchwork and want to solve this... 1 * * * * service php5-fpm restart > /dev/null I searched extensively on Google - got no help.
As mentioned, this a test-server in LAN, CPU load is never crossed 0.10 and memory usage is also below 25% (System has 2GB RAM and ubuntu-server installed)
So if you find its time-confusing to help me out, please atleast drop a hint. Thanks in advance for help. -Rahul (note - this is reposting of - http://forum.nginx.org/read.php?11,127694 ) Update: I found answer, which is posted below. | I found answer on my posting on the nginx forum - http://forum.nginx.org/read.php?2,127854 The answer, in my case, is to set: request_terminate_timeout=30s in php-fpm config (usually /etc/php5/fpm/php-fpm.conf ) Note, you can use values other than 30s also. I used it to match my value in main php.ini file which is: max_execution_time = 30 Thanks All. :-) | {
"source": [
"https://serverfault.com/questions/178671",
"https://serverfault.com",
"https://serverfault.com/users/17440/"
]
} |
179,419 | When I try to send an email on my postfix server to an address on the same domain (for example, if the server hostname is mail.example.com and I try to send an email to [email protected]), I get the following error in the log and the email is not delivered: Recipient address rejected: User unknown in local recipient table . If I send to an address on another domain, I don't have any problems. Here is my /etc/postfix/main.cf file: smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mail.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#myorigin = /etc/mailname
myorigin = $mydomain
mydestination = $mydomain, localhost.$mydomain, localhost
relayhost =
#fake IP address
mynetworks = 127.0.0.0/8 100.837.191.223
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all | I know this question is a little old, so I'm assuming it's been answered satisfactorily already. I just had this same issue, and it took me a while to figure out what was going on. I think my situation was the same as the original question. Postfix should relay all mail to other servers on the internet, it does not actually receive mail for any domains. So any mail sent to example.com should be forwarded to the mail server for example.com. The solution, as explained b techieb0y, is to remove $mydomain from the line: mydestination = $mydomain, localhost.$mydomain, localhost This line tells postfix that any messages sent to $mydomain are to be received and stored on this server. That's not what I want, I want those messages to be sent to the actual mailserver for example.com. Once I realised this, and removed example.com, mail worked as I expected. I'm posting this on the off chance that this explanation helps somebody else who stumbles upon this question in the future. | {
"source": [
"https://serverfault.com/questions/179419",
"https://serverfault.com",
"https://serverfault.com/users/1147/"
]
} |
179,570 | I have an issue with the package openqrm. How do I remove it? root@wl183004:/# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up openqrm (4.6-ubuntu1) ...
.: 33: Can't open /usr/share/openqrm/etc/openqrm-server.conf
dpkg: error processing openqrm (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
openqrm
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@wl183004:/# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up openqrm (4.6-ubuntu1) ...
.: 33: Can't open /usr/share/openqrm/etc/openqrm-server.conf
dpkg: error processing openqrm (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
openqrm
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@wl183004:/# apt-get remove --purge openqrm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libshadow-ruby1.8 bind9 libopenipmi0 nagios-plugins-basic open-iscsi
nagios-plugins-standard memcached libupsclient1 collectd-core nagios-images
bind9utils tftpd-hpa radiusclient1 libdbi0 libphp-adodb collectd libruby
aoetools facter dhcp3-server open-iscsi-utils liboping0 libmemcached2
libradius1 libyajl1 nagios-plugins puppet-common puppetmaster
libopenssl-ruby1.8 libopenssl-ruby libesmtp5 libxmlrpc-ruby
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
openqrm*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 78.2MB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 313464 files and directories currently installed.)
Removing openqrm ...
.: 32: Can't open /usr/share/openqrm/etc/openqrm-server.conf
dpkg: error processing openqrm (--purge):
subprocess installed pre-removal script returned error exit status 2
.: 33: Can't open /usr/share/openqrm/etc/openqrm-server.conf
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
openqrm
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@wl183004:/# | You might try to upgrade the package before purging it. In some cases, the new package will fix the removal script ( dpkg is made so that new packages can fix even the transition scripts of old packages). If that doesn't work, have a look at /var/lib/dpkg/info/openqrm.postinst like Kyle suggested, locate the line that fails, comment it out and try to purge again. Repeat until success. | {
"source": [
"https://serverfault.com/questions/179570",
"https://serverfault.com",
"https://serverfault.com/users/24812/"
]
} |
179,630 | I would like to see the Time-To-Live (TTL) value for a CNAME record. I have access to dig (on Apple Mac OS X), which gives me an answer like this: % dig host.example.gov
<*SNIP*>
;; ANSWER SECTION:
host.example.gov. 43200 IN CNAME host1.example.gov.
host1.example.gov. 43200 IN A 192.168.16.10 Is the value '43200' the TTL for this DNS record? | Yes, the number there is the number of seconds left until that record expires (providing we're not querying the authoritative nameserver). Obviously with a CNAME there's a level of redirection, so the TTL for the A record it points to in this case may be important as well. If you wait a couple of seconds and run dig again on your local nameserver, you should see that TTL number decrease by the number of seconds you waited (approximately). When it hits 0, it'll refresh or if your nameserver refreshes the zone for some reason. As mentioned above, there is a difference between dig being run against a nameserver with a cached entry and the nameserver that is authoritative for that entry. (in the examples I use below I use the +noauthority +noquestion & +nostats flags just to keep the output terse). Note the difference between the following queries: $ dig +noauthority +noquestion +nostats stackoverflow.com @ns2.p19.dynect.net.
; <<>> DiG 9.7.0-P1 <<>> +noauthority +noquestion +nostats stackoverflow.com @ns2.p19.dynect.net.
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50066
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; ANSWER SECTION:
stackoverflow.com. 432000 IN A 69.59.196.211 So in the above query, we're querying a nameserver that is authoritative for stackoverflow.com. If you notice the flags section, pay special attention to the aa flag which denotes this is an authoritative answer (i.e. not cached). $ dig +noauthority +noquestion +noadditional +nostats stackoverflow.com
; <<>> DiG 9.7.0-P1 <<>> +noauthority +noquestion +noadditional +nostats stackoverflow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43514
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; ANSWER SECTION:
stackoverflow.com. 246696 IN A 69.59.196.211 In the above query, we don't have an aa flag, and the TTL will keep decreasing as we query and query. This is essentially the counter I was talking about previously. | {
"source": [
"https://serverfault.com/questions/179630",
"https://serverfault.com",
"https://serverfault.com/users/36178/"
]
} |
179,636 | We have a SonicWall TZ180 that acts as a VPN endpoint. Right now it has one WAN IP address and a /24 assigned to the LAN interface. Our mail cluster administrator asked if it was possible to add a second private class C behind the VPN. This second subnet would be available to the other network and then we would use address objects and acls to limit access. Is this possible? I read up on PortShield but I don't know if that's what we would need to use because we're pushing all data out of one physical port into a Cisco switch that has VLANs already set up. Addendum:
It appears that PortShields will do what I want with only one limitation; it requires a direct 1-1 relationship of portshield to physical port. This would then limit us to 4 PortShields on 1 TZ180. Is there a better solution than this? | Yes, the number there is the number of seconds left until that record expires (providing we're not querying the authoritative nameserver). Obviously with a CNAME there's a level of redirection, so the TTL for the A record it points to in this case may be important as well. If you wait a couple of seconds and run dig again on your local nameserver, you should see that TTL number decrease by the number of seconds you waited (approximately). When it hits 0, it'll refresh or if your nameserver refreshes the zone for some reason. As mentioned above, there is a difference between dig being run against a nameserver with a cached entry and the nameserver that is authoritative for that entry. (in the examples I use below I use the +noauthority +noquestion & +nostats flags just to keep the output terse). Note the difference between the following queries: $ dig +noauthority +noquestion +nostats stackoverflow.com @ns2.p19.dynect.net.
; <<>> DiG 9.7.0-P1 <<>> +noauthority +noquestion +nostats stackoverflow.com @ns2.p19.dynect.net.
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50066
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; ANSWER SECTION:
stackoverflow.com. 432000 IN A 69.59.196.211 So in the above query, we're querying a nameserver that is authoritative for stackoverflow.com. If you notice the flags section, pay special attention to the aa flag which denotes this is an authoritative answer (i.e. not cached). $ dig +noauthority +noquestion +noadditional +nostats stackoverflow.com
; <<>> DiG 9.7.0-P1 <<>> +noauthority +noquestion +noadditional +nostats stackoverflow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43514
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; ANSWER SECTION:
stackoverflow.com. 246696 IN A 69.59.196.211 In the above query, we don't have an aa flag, and the TTL will keep decreasing as we query and query. This is essentially the counter I was talking about previously. | {
"source": [
"https://serverfault.com/questions/179636",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
180,711 | By default, htop shows colored status bars for processors, memory, and swap. From left to right, the bars are colored green, blue, yellow, and red depending on some thresholds. What does it mean when the Memory bar has a small level of green and blue, and almost all the remainder is yellow? The swap bar is empty. The color settings for htop are "default". | Hitting F1 or h will show you the key. But for reference, the default colors are: CPU: Blue = Low priority threads Green = Normal priority threads Red = Kernel threads Memory: Green = Used memory Blue = Buffers Yellow/Orange = Cache There are a couple of different color-schemes available, you can see them through hitting F2 . | {
"source": [
"https://serverfault.com/questions/180711",
"https://serverfault.com",
"https://serverfault.com/users/53093/"
]
} |
180,715 | I am planning on putting ESX on a compact flash media and making it bootable these will be running on high-performace servers. My question is: Is CF a good idea and if so what CF read/write speed should I be looking for ESX specifically? Currently looking at this for the reader: http://www.lycom.com.tw/ST138.htm Thanks in advance for your help. | Hitting F1 or h will show you the key. But for reference, the default colors are: CPU: Blue = Low priority threads Green = Normal priority threads Red = Kernel threads Memory: Green = Used memory Blue = Buffers Yellow/Orange = Cache There are a couple of different color-schemes available, you can see them through hitting F2 . | {
"source": [
"https://serverfault.com/questions/180715",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
180,853 | I have Eclipse projects and ".project" file in them, the directory structure looks like ' myProject/.project '. I want to copy these '.project' files to another directory, but I want the enclosing directory name to be preserved. Let's say I have ' a/myProject/.project ', I want to copy ' myProject/.project ' to ' b ', so it be ' b/myProject/.project ', but ' b/myProject ' doesn't exist. When I try in a: cp -r ./myProject/.project ../b it copies only '.project' file itself, without 'myProject' directory. Please advise. | The switch you need is --parents , e.g.: jim@prometheus:~$ cp --parents test/1/.moo test2/
jim@prometheus:~$ ls -la test2/
total 42
drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 .
drwxr-xr-x 356 jim jim 43136 2010-09-14 09:32 ..
drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 test
jim@prometheus:~$ ls -la test2/test/1/.moo
-rw-r--r-- 1 jim jim 0 2010-09-14 09:32 test2/test/1/.moo | {
"source": [
"https://serverfault.com/questions/180853",
"https://serverfault.com",
"https://serverfault.com/users/54192/"
]
} |
181,015 | A colleague of mine recently ran into a problem where a process that had supposedly died was still bound to a network port, preventing other processes from binding to that port. Specifically, netstat -a -b was reporting that a process named System with PID 4476 had port 60001 open, except no process with PID 4476 existed, at least as far as I could tell. Process Explorer and Task Manager did not list PID 4476 (though there was another process named System with PID 4, which had its own set of TCP connections that did not include 60001). taskkill /PID 4476 also reported that PID 4476 could not be found. Is there a way to kill this mysterious System process to free up the port to which it's currently bound? What can cause this to happen? How can there be processes that none of Task Manager, Process Explorer, and taskkill don't know about? Rebooting managed to fix the problem, but I'd like to know if there's a way to fix this without rebooting. | I know this is an old thread, but in case anyone else is having the same issue, I had... What may be happening is that your process had a TCP port open when it crashed or otherwise exited without explicitly closing it. Normally the OS cleans up these sorts of things, but only when the process record goes away. While the process may not appear to be running any more, there is at least one thing that can keep a record of it around, in order to prevent reuse of its PID. This is the existence of a child process that is not detached from the parent. If your program spawned any processes while it was running, try killing them. That should cause its process record to be freed and the TCP port to be cleaned up. Apparently windows does this when the record is released not when the process exits as I would have expected. | {
"source": [
"https://serverfault.com/questions/181015",
"https://serverfault.com",
"https://serverfault.com/users/54165/"
]
} |
181,024 | our mysql system is "freezing" every two days. By "freezing" i mean the following: it doesn't respond to ping we can't login with SSH we don't get any answer from MySQL there is no entry in the error logs! neither from linux neither from MySQL. we have already changed to a completely new hardware, we have the same problem, so it's definitely not a hardware problem. we do not have any other software installed except a firewall (iptables rule) we can restart the server from another server using rsyslog (www.rsyslog.com)(software reset) Could someone help me, by giving me some pointers what could i do to figure out the problem? I have included every detail about our settings. Thank you in advance for your help. Max. Our system parameters and settings: System-Memory: 12GB Processor: Intel 7-920 Quadcore Operating system: Debian 5 (lenny) 64bit MySQL 5.1.49 Databases: (a) a small phpbb forum (b) a 6GB database 3 tables with about 15 million rows my.cnf #
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = our-ip-address
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 256K
thread_cache_size = 32
max_connections = 300
table_cache = 2048
#thread_concurrency = 4
# Used for InnoDB tables recommended to 50%-80% available memory
innodb_buffer_pool_size = 6G
# 20MB sometimes larger
innodb_additional_mem_pool_size = 20M
# 8M-16M is good for most situations
innodb_log_buffer_size = 8M
# Disable XA support because we do not use it
innodb-support-xa = 0
# 1 is default wich is 100% secure but 2 offers better performance
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
#innodb_thread_concurency = 8
# Recommended 64M - 512M depending on server size
innodb_log_file_size = 512M
# One file per table
innodb_file_per_table
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#query_cache_type = 1
#query_cache_min_res_unit= 2K
#join_buffer_size = 1M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# * InnoDB plugin
# As of MySQL 5.1.38, the InnoDB plugin from Oracle is included in the MySQL source code.
# It has many improvements and better performances than the built-in InnoDB storage engine.
# Please read http://www.innodb.com/products/innodb_plugin/ for more information.
# Uncommenting the two following lines to use the InnoDB plugin.
ignore_builtin_innodb
plugin-load=innodb=ha_innodb_plugin.so
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1
#
# * IMPORTANT: Additional settings that can override those from this file!
#
!includedir /etc/mysql/conf.d/ UPDATE After installing sysstat and configuring it to collect data after every minute i have the following datas.
I used sar to generate the following output: The log-file is too big so coudn't enter it here but uploaded to box.net.
The link is http://www.box.net/shared/xc6rh7qqob SECOND UPDATE We started a ping command in the background, and that solved the problem. Now the server does work since more then a week. We still don't know what's the problem. | I know this is an old thread, but in case anyone else is having the same issue, I had... What may be happening is that your process had a TCP port open when it crashed or otherwise exited without explicitly closing it. Normally the OS cleans up these sorts of things, but only when the process record goes away. While the process may not appear to be running any more, there is at least one thing that can keep a record of it around, in order to prevent reuse of its PID. This is the existence of a child process that is not detached from the parent. If your program spawned any processes while it was running, try killing them. That should cause its process record to be freed and the TCP port to be cleaned up. Apparently windows does this when the record is released not when the process exits as I would have expected. | {
"source": [
"https://serverfault.com/questions/181024",
"https://serverfault.com",
"https://serverfault.com/users/54234/"
]
} |
181,094 | This turns out to be harder than I thought. The routes I want to delete are the "!" rejected routes, but I can't seem to formulate the right "route del" command to pull it off. Here is the routing table... Destination Gateway Genmask Flags Metric Ref Use Iface
67.40.227.206 * 255.255.255.255 UH 0 0 0 ppp0
192.168.46.79 * 255.255.255.255 UH 0 0 0 ipsec0
192.168.46.79 - 255.255.255.255 !H 2 - 0 -
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
10.1.0.0 * 255.255.0.0 U 0 0 0 ipsec0
10.1.0.0 - 255.255.0.0 ! 2 - 0 -
default * 0.0.0.0 U 3 0 0 ppp0
default * 0.0.0.0 U 4 0 0 ppp0 I have two entries for 192.168.46.79 and 10.1.0.0. These are auto-generated by the little Linux based router I'm using. I can ping the IPSEC tunnels from the shell itself, but traffic from the LAN takes the second route (the rejected "!" or "!H" route) for reasons I simply don't understand. | with the route -n command you'll obtain Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.178.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 160.98.123.1 0.0.0.0 UG 600 0 0 wlan0 sudo route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth0 you'll get all parameters respectively from above | {
"source": [
"https://serverfault.com/questions/181094",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
181,638 | I'd like some tools for ubuntu that I can use to test my server, how much it can handle. Any suggestions? I've used apache benchmark before, but I'd like to try out something else. (As a side question, does apache benchmark work if I'm only using nginx?) | ab only sends web requests, it doesn't care what the server is that it is testing. However, it only tests one page. There is perfmeter, siege, httpload, jmeter and a number of others. httpload is rather nice since you can feed it a series of URLs that will be tested. | {
"source": [
"https://serverfault.com/questions/181638",
"https://serverfault.com",
"https://serverfault.com/users/41287/"
]
} |
181,787 | what is the default sorting order for entries returned by the linux find command? For example, if I issue find . -type f -name '*mp3' and the output consists of multiple files across multiple sub-folders, what is the default order in which directories are listed? At the same time, what is the sorting order in which files within an individual directory are listed? Sometimes it returns: ./B/01.mp3
./A/01.mp3
./A/04.mp3
./A/02.mp3 See how first the contents of directory B is listed, then that of directory A. At the same time within directory A, files are listed in a funny order. | find will be traversing the directory tree in the order items are stored within the directory entries. This will (mostly) be consistent from run to run, on the same machine and will essentially be "file/directory creation order" if there have been no deletes. However, some file systems will re-order directory entries as part of compaction operations or when the size of the entry needs to be expanded, so there's always a small chance the "raw" order will change over time. If you want a consistent order, feed the output through an extra sorting stage. | {
"source": [
"https://serverfault.com/questions/181787",
"https://serverfault.com",
"https://serverfault.com/users/54459/"
]
} |
181,927 | I manage multiple websites that currently have the following DNS configuration: example.com - A Record - Production Server IP
test.example.com - A Record - Test Server IP
www.example.com - CNAME - example.com
beta.example.com - CNAME - test.example.com
dev.example.com - CNAME - test.example.com Is this an appropriate use of CNAME records? I've looked online and have not found a clear answer. Some people claim that CNAME records are bad (they are not, however, clear on why this is) and propose the following setup: example.com - A Record - Production Server IP
test.example.com - A Record - Test Server IP
www.example.com - A Record - Production Server IP
beta.example.com - A Record - Test Server IP
dev.example.com - A Record - Test Server IP Which one of these is the better approach (and why)? Note: The subdomains do not require their own MX records, so that is not an issue here. | Yes, that's an appropriate use of CNAMEs. In the discussions I've been part of, the arguments tend to go like this: Against CNAMEs: There is a (tiny) performance penalty, as the downstream DNS caches need to perform 2 DNS lookups, one for the CNAME and one for the A-Record the CNAME points to. Vague, bogus arguments about CNAMEs having less "authority" or compatibility issues. In favor of CNAMEs: They provide a clean abstraction between hardware (physical servers) and services. They simplify DNS management -- when a server moves, you only need to change one record. After trying a couple of different ways to do this, I now have a personal favorite style. It is: One A Record for each physical server; with a fairly low TTL (perhaps 30 minutes); giving the server a human-friendly name . One CNAME for each service; with a high TTL (perhaps 24 hours); pointing to the above server names. As the sole exeption to the rules above, the domain root is an A-Record, pointing to the webserver / web load balancer. (The @ is required to be an A-record.) I find that this setup works well. It keeps extra DNS lookups for the CNAMES down; and if a server crashes I can still change public DNS around fairly fast. Here's a (improvised) example in BIND syntax: ;name ttl class rr value
server01 30m IN A 192.168.0.3
server02 30m IN A 192.168.0.4
webmail 24h IN CNAME server01
extranet 24h IN CNAME server02
ftp 24h IN CNAME server02 | {
"source": [
"https://serverfault.com/questions/181927",
"https://serverfault.com",
"https://serverfault.com/users/2293/"
]
} |
181,956 | I'm the process of setting up a monitoring of DNS servers of several large web hosts.
My goal is to compare their dns servers response times by tracking their response to ping. In the process, I discovered that Bluehost nameservers do not respond to ping.
I tried to get more information by running Pingdom DNS Check on bluehost.com and it produced the following error: Name server ns1.bluehost.com (74.220.195.31) does not answer queries over TCP. The name server failed to answer queries sent over TCP. This is probably due to the name server not correctly set up or due to misconfgured filtering in a firewall. It is a rather common misconception that DNS does not need TCP unless they provide zone transfers - perhaps the name server administrator is not aware that TCP usually is a requirement. I would like to know the following: To what extent is the above statement
true? What are the implications of a
nameserver not answering queries over
TCP? | The diagnostic text from Pingdom is exactly correct. TCP is not just for zone transfers. DNS server implementations are now "required" (in so much as any RFC requires anything) to support TCP, per RFC 5966 , "DNS Transport over TCP - Implementation Requirements". Note that this is a requirement on the server software implementation, it does not strictly apply to the operation of any server - operational practice is not covered. That said, if your particular DNS servers are not configured to support TCP, or if it is blocked, then the longer term effect will be an inability to support DNSSEC correctly. Similarly any other DNS data which causes responses to exceed 512 bytes might be blocked. ob disclaimer: I wrote that RFC. EDIT RFC 5966 has now been replaced by RFC 7766 | {
"source": [
"https://serverfault.com/questions/181956",
"https://serverfault.com",
"https://serverfault.com/users/26371/"
]
} |
181,960 | Current Configuration We have two sites that are connected via a gateway-to-gateway VPN tunnel using Cisco RV082 routers . We also have VPN access using QuickVPN for our Windows employees and PPTP for the few of us that run Mac OS X or Ubuntu Linux. The RV082's QuickVPN reliability and performance has always left a little to be desired. One of our RV082's is starting to act flakey, so I'm interested in purchasing a replacement. Question Should we buy another RV082, or is there a better solution to meet our desired configuration? At this point, I'm interested in only replacing one of the two RV082s, so if we did buy something else, it would have to be able to create a VPN tunnel with our remote site. Desired Configuration Provide a permanent VPN tunnel to connect our HQ and remote site, which has an RV082 Provide up to 5-10 concurrent VPN connections for traveling/remote workers (we have 26 employees, so that should be sufficient for now) Wireless is not required, as we have separate wireless access points Possible Options Cisco SA 540 , although I can't tell from my cursory review if there are any recurring costs associated with VPN access of remote users Post-Upgrade Update On Monday, June 20, 2011, we replaced our Cisco RV082 routers a PC Engines' ALIX SBC running pfSense version 2.0-RC3 (i386). So far, we're very happy with the upgrade. Benefits include: More informative status and diagnostics including RRD Graphs Wider selection of VPN options (QuickVPN never seemed to work that great for our road warriors) | The diagnostic text from Pingdom is exactly correct. TCP is not just for zone transfers. DNS server implementations are now "required" (in so much as any RFC requires anything) to support TCP, per RFC 5966 , "DNS Transport over TCP - Implementation Requirements". Note that this is a requirement on the server software implementation, it does not strictly apply to the operation of any server - operational practice is not covered. That said, if your particular DNS servers are not configured to support TCP, or if it is blocked, then the longer term effect will be an inability to support DNSSEC correctly. Similarly any other DNS data which causes responses to exceed 512 bytes might be blocked. ob disclaimer: I wrote that RFC. EDIT RFC 5966 has now been replaced by RFC 7766 | {
"source": [
"https://serverfault.com/questions/181960",
"https://serverfault.com",
"https://serverfault.com/users/20648/"
]
} |
182,277 | I am having some wierd issues with Apache2 server on my ubuntu server. I believe some configuration files may have been tampered with. What is the easiest way to remove apache2 completely from my server. I am aware of how to install by using sudo apt-get install apache2 but, I just want to make sure I completely remove apache2. | Run the following two commands: sudo apt-get --purge remove apache2
sudo apt-get remove apache2-common | {
"source": [
"https://serverfault.com/questions/182277",
"https://serverfault.com",
"https://serverfault.com/users/54595/"
]
} |
182,550 | one of my servers (Debian 5.0.6) has two public ip-address on the same interface. This used to work well for months but suddenly it is using "the wrong" ip addresses for outgoing connections. This is a problem because the reverse lookup will not match and emails therefore get spam points. eth0 Link encap:Ethernet Hardware Adresse 00:1b:21:14:8e:9c
inet Adresse:81.169.180.51 Bcast:81.169.180.51 Maske:255.255.255.255
inet6-Adresse: fe80::21b:21ff:fe14:8e9c/64 Gültigkeitsbereich:Verbindung
eth0:0 Link encap:Ethernet Hardware Adresse 00:1b:21:14:8e:9c
inet Adresse:85.214.157.120 Bcast:85.214.157.120 Maske:255.255.255.255
Kernel-IP-Routentabelle
Destination Router Genmask Flags Metric Ref Use Iface
81.169.180.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
0.0.0.0 81.169.180.1 0.0.0.0 UG 0 0 0 eth0 Currently it is using 85.214.157.120 for outbound connections. How do I get it to use 81.169.180.51? Edit : The netmask of 255.255.255.255 is consistent with both documentation and DHCP response of the hosting company. Calling /etc/init.d/networking restart multiple times will eventually end up with the correct ip-address for outbount connections. But that is obviously not a stable solution. /Edit Edit 2 : To make sure that the host route is not related to my issue, I setup a local test network: eth0 inet Adresse:192.168.0.2 Bcast:192.168.0.255 Maske:255.255.255.0
eth0:0 inet Adresse:192.168.0.3 Bcast:192.168.0.255 Maske:255.255.255.0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 If anyone has an idea how to make sure that source ip-address 192.168.0.2 is used on outbound tcp connections, I'd be thankful. /Edit 2 | Update default: ip route change default via 81.169.180.1 src 81.169.180.51 Check configuration: ip route list | {
"source": [
"https://serverfault.com/questions/182550",
"https://serverfault.com",
"https://serverfault.com/users/23268/"
]
} |
183,431 | Getting all extensions for a directory: easy. Getting file counts for a particular extension: easy. But getting all file extensions and their respective file counts is alluding me. eg. + dir
+ abc.txt
+ def.txt
+ abc.pdf
* def.pov should return something like: .txt 2
.pdf 1
.pov 1 The aim of this exercise is that I want to find out which file extension is popular in a certain directory. Thanks in advance | /var/cache$ sudo find ./ -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
1 .6
1 .cache
1 .noconf
1 .php
1 .sl
2 .bin
2 .el
2 .tdb
4 .baseA
4 .baseB
4 .dat
4 .DB
27 .db
221 .deb Here is the explication: find ./ -type f find only file, not directory grep -E ".*\.[a-zA-Z0-9]*$" filter file with extension sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' delete path and file name, save only extension sort | uniq -c | sort -n sort, uniq and sort | {
"source": [
"https://serverfault.com/questions/183431",
"https://serverfault.com",
"https://serverfault.com/users/46130/"
]
} |
183,461 | I have two servers. The program on the first needs to communicate with the second on port 2194. I know its not working, because when I do: root@server1 [~]# telnet myserver2.com 2194
Trying 123.123.123.98...
telnet: connect to address 123.123.123.98: Connection timed out
telnet: Unable to connect to remote host: Connection timed out server1# iptables -L -n
Chain INPUT (policy DROP)
...
...
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy DROP)
...
Chain LOCALINPUT (1 references)
target prot opt source destination
...
Chain LOCALOUTPUT (1 references)
target prot opt source destination
...
Chain LOGDROPIN (1 references)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0
Chain LOGDROPOUT (1 references)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0 | To allow outgoing connections from server1 to server2 on TCP port 2194, use this on server1: iptables -A OUTPUT -p tcp -d <server2ip> --dport 2194 -j ACCEPT To allow incoming connections from server1 to server2 on TCP port 2194, use this on server2: iptables -A INPUT -p tcp -s <server1ip> --dport 2194 -j ACCEPT | {
"source": [
"https://serverfault.com/questions/183461",
"https://serverfault.com",
"https://serverfault.com/users/54725/"
]
} |
183,474 | I have the following postfix virtual file: [email protected] [email protected] This correctly forwards all emails to [email protected] to [email protected] However I would like to forward these emails to [email protected] as well. I tried this change and it does not seem to work: [email protected] [email protected]
[email protected] [email protected] How do I tell postfix to forward all emails to multiple recipients? | Put all your addresses on the same line separated by commas as explained in the Postfix manual for virtual . [email protected] [email protected],[email protected] Should do the trick. | {
"source": [
"https://serverfault.com/questions/183474",
"https://serverfault.com",
"https://serverfault.com/users/1268/"
]
} |
183,526 | I have what appears to be weird and convoluted set of rules which work for me at the moment. Is there a way of "exporting" those and saving them to a file so that they can be restored later on in case things are messed up? | With suitable privilege iptables-save > /some/file will save your iptables configuration to /some/file and iptables-restore < /some/file will restore your saved configuration from /some/file . | {
"source": [
"https://serverfault.com/questions/183526",
"https://serverfault.com",
"https://serverfault.com/users/54725/"
]
} |
183,821 | Background: physical server, about two years old, 7200-RPM SATA drives connected to a 3Ware RAID card, ext3 FS mounted noatime and data=ordered, not under crazy load, kernel 2.6.18-92.1.22.el5, uptime 545 days. Directory doesn't contain any subdirectories, just millions of small (~100 byte) files, with some larger (a few KB) ones. We have a server that has gone a bit cuckoo over the course of the last few months, but we only noticed it the other day when it started being unable to write to a directory due to it containing too many files. Specifically, it started throwing this error in /var/log/messages: ext3_dx_add_entry: Directory index full! The disk in question has plenty of inodes remaining: Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 60719104 3465660 57253444 6% / So I'm guessing that means we hit the limit of how many entries can be in the directory file itself. No idea how many files that would be, but it can't be more, as you can see, than three million or so. Not that that's good, mind you! But that's part one of my question: exactly what is that upper limit? Is it tunable? Before I get yelled at—I want to tune it down ; this enormous directory caused all sorts of issues. Anyway, we tracked down the issue in the code that was generating all of those files, and we've corrected it. Now I'm stuck with deleting the directory. A few options here: rm -rf (dir) I tried this first. I gave up and killed it after it had run for a day and a half without any discernible impact. unlink(2) on the directory: Definitely worth consideration, but the question is whether it'd be faster to delete the files inside the directory via fsck than to delete via unlink(2). That is, one way or another, I've got to mark those inodes as unused. This assumes, of course, that I can tell fsck not to drop entries to the files in /lost+found; otherwise, I've just moved my problem. In addition to all the other concerns, after reading about this a bit more, it turns out I'd probably have to call some internal FS functions, as none of the unlink(2) variants I can find would allow me to just blithely delete a directory with entries in it. Pooh. while [ true ]; do ls -Uf | head -n 10000 | xargs rm -f 2>/dev/null; done ) This is actually the shortened version; the real one I'm running, which just adds some progress-reporting and a clean stop when we run out of files to delete, is: export i=0;
time ( while [ true ]; do
ls -Uf | head -n 3 | grep -qF '.png' || break;
ls -Uf | head -n 10000 | xargs rm -f 2>/dev/null;
export i=$(($i+10000));
echo "$i...";
done ) This seems to be working rather well. As I write this, it has deleted 260,000 files in the past thirty minutes or so. Now, for the questions: As mentioned above, is the per-directory entry limit tunable? Why did it take "real 7m9.561s / user 0m0.001s / sys 0m0.001s" to delete a single file which was the first one in the list returned by ls -U , and it took perhaps ten minutes to delete the first 10,000 entries with the command in #3, but now it's hauling along quite happily? For that matter, it deleted 260,000 in about thirty minutes, but it's now taken another fifteen minutes to delete 60,000 more. Why the huge swings in speed? Is there a better way to do this sort of thing? Not store millions of files in a directory; I know that's silly, and it wouldn't have happened on my watch. Googling the problem and looking through SF and SO offers a lot of variations on find that are not going to be significantly faster than my approach for several self-evident reasons. But does the delete-via-fsck idea have any legs? Or something else entirely? I'm eager to hear out-of-the-box (or inside-the-not-well-known-box) thinking. Thanks for reading the small novel; feel free to ask questions and I'll be sure to respond. I'll also update the question with the final number of files and how long the delete script ran once I have that. Final script output!: 2970000...
2980000...
2990000...
3000000...
3010000...
real 253m59.331s
user 0m6.061s
sys 5m4.019s So, three million files deleted in a bit over four hours. | Update August 2021 This answer continues to attract a lot of attention and I feel as if its so woefully out of date it kind of is redundant now. Doing a find ... -delete is most likely going to produce acceptable results in terms of performance. The one area I felt might result in a higher performance is tackling the 'removing' part of the problem instead of the 'listing' part. I tried it and it didn't work. But I felt it was useful to explain what I did and why. In todays newer kernels, through the use of the IO uring subsystem in the kernel (see man 2 io_uring_setup ) it is actually possible to attempt to perform unlinks asynchronously -- meaning we can submit unlink requests without waiting or blocking to see the result. This program basically reads a directory, submits hundreds of unlinks without waiting for the result, then reaps the results later once the system is done handling the request. It tries to do what dentls did but uses IO uring. Can be compiled with gcc -o dentls2 dentls2.c -luring . #include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <err.h>
#include <sched.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <linux/io_uring.h>
#include <liburing.h>
/* Try to keep the queue size to under two pages as internally its stored in
* the kernel as contiguously ordered pages. Basically the bigger you make it
* the higher order it becomes and the less likely you'll have the contiguous
* pages to support it, despite not hitting any user limits.
* This reduces an ENOMEM here by keeping the queue size as order 1
* Ring size internally is rougly 24 bytes per entry plus overheads I haven't
* accounted for.
*/
#define QUEUE_SIZE 256
/* Globals to manage the queue */
static volatile int pending = 0;
static volatile int total_files = 0;
/* Probes kernel uring implementation and checks if action is
* supported inside the kernel */
static void probe_uring(
struct io_uring *ring)
{
struct io_uring_probe *pb = {0};
pb = io_uring_get_probe_ring(ring);
/* Can we perform IO uring unlink in this kernel ? */
if (!io_uring_opcode_supported(pb, IORING_OP_UNLINKAT)) {
free(pb);
errno = ENOTSUP;
err(EXIT_FAILURE, "Unable to configure uring");
}
free(pb);
}
/* Place a unlink call for the specified file/directory on the ring */
static int submit_unlink_request(
int dfd,
const char *fname,
struct io_uring *ring)
{
char *fname_cpy = strdup(fname);
struct io_uring_sqe *sqe = NULL;
/* Fetch a free submission entry off the ring */
sqe = io_uring_get_sqe(ring);
if (!sqe)
/* Submission queue full */
return 0;
pending++;
/* Format the unlink call for submission */
io_uring_prep_rw(IORING_OP_UNLINKAT, sqe, dfd, fname_cpy, 0, 0);
sqe->unlink_flags = 0;
/* Set the data to just be the filename. Useful for debugging
* at a later point */
io_uring_sqe_set_data(sqe, fname_cpy);
return 1;
}
/* Submit the pending queue, then reap the queue
* clearing up room on the completion queue */
static void consume_queue(
struct io_uring *ring)
{
char *fn;
int i = 0, bad = 0;
int rc;
struct io_uring_cqe **cqes = NULL;
if (pending < 0)
abort();
cqes = calloc(pending, sizeof(struct io_uring_cqe *));
if (!cqes)
err(EXIT_FAILURE, "Cannot find memory for CQE pointers");
/* Notify about submitted entries from the queue (this is a async call) */
io_uring_submit(ring);
/* We can immediately take a peek to see if we've anything completed */
rc = io_uring_peek_batch_cqe(ring, cqes, pending);
/* Iterate the list of completed entries. Check nothing crazy happened */
for (i=0; i < rc; i++) {
/* This returns the filename we set earlier */
fn = io_uring_cqe_get_data(cqes[i]);
/* Check the error code of the unlink calls */
if (cqes[i]->res < 0) {
errno = -cqes[i]->res;
warn("Unlinking entry %s failed", fn);
bad++;
}
/* Clear up our CQE */
free(fn);
io_uring_cqe_seen(ring, cqes[i]);
}
pending -= rc + bad;
total_files += rc - bad;
free(cqes);
}
/* Main start */
int main(
const int argc,
const char **argv)
{
struct io_uring ring = {0};
struct stat st = {0};
DIR *target = NULL;
int dfd;
struct dirent *fn;
/* Check initial arguments passed make sense */
if (argc < 2)
errx(EXIT_FAILURE, "Must pass a directory to remove files from.");
/* Check path validity */
if (lstat(argv[1], &st) < 0)
err(EXIT_FAILURE, "Cannot access target directory");
if (!S_ISDIR(st.st_mode))
errx(EXIT_FAILURE, "Path specified must be a directory");
/* Open the directory */
target = opendir(argv[1]);
if (!target)
err(EXIT_FAILURE, "Opening the directory failed");
dfd = dirfd(target);
/* Create the initial uring for handling the file removals */
if (io_uring_queue_init(QUEUE_SIZE, &ring, 0) < 0)
err(EXIT_FAILURE, "Cannot initialize URING");
/* Check the unlink action is supported */
probe_uring(&ring);
/* So as of writing this code, GETDENTS doesn't have URING support.
* but checking the kernel mailing list indicates its in progress.
* For now, we'll just do laymans readdir(). These days theres no
* actual difference between it and making the getdents() call ourselves.
*/
while (fn = readdir(target)) {
if (fn->d_type != DT_REG)
/* Pay no attention to non-files */
continue;
/* Add to the queue until its full, try to consume it
* once its full.
*/
while (!submit_unlink_request(dfd, fn->d_name, &ring)) {
/* When the queue becomes full, consume queued entries */
consume_queue(&ring);
/* This yield is here to give the uring a chance to
* complete pending requests */
sched_yield();
continue;
}
}
/* Out of files in directory to list. Just clear the queue */
while (pending) {
consume_queue(&ring);
sched_yield();
}
printf("Total files: %d\n", total_files);
io_uring_queue_exit(&ring);
closedir(target);
exit(0);
} The results were ironically opposite what I suspected, but why? TMPFS with 4 million files $ time ./dentls2 /tmp/many
Total files: 4000000
real 0m6.459s
user 0m0.360s
sys 0m24.224s Using find: $ time find /tmp/many -type f -delete
real 0m9.978s
user 0m1.872s
sys 0m6.617s BTRFS with 10 million files $ time ./dentls2 ./many
Total files: 10000000
real 10m25.749s
user 0m2.214s
sys 16m30.865s Using find: time find ./many -type f -delete
real 7m1.328s
user 0m9.209s
sys 4m42.000s So it looks as if batched syscalls dont make an improvement in real time. The new dentls2 spends much more time working (four times as much) only to result in worse performance. So a net loss in overall efficiency and worse latency. dentls2 is worse. The cause of this is because io_uring produces kernel dispatcher threads to do the unlink work internally, but the directory inode being worked on can only be modified by a single writer at one time. Basically using the uring we're creating lots of little threads but only one thread is allowed to delete from the directory. We've just created a bunch of contention and eliminated the advantage of doing batched IO. Using eBPF you can measure the unlink frequencies and watch what causes the delays. In the case of BTRFS its the kernel function call btrfs_commit_inode_delayed_inode which acquires the lock when unlink is called. With dentls2 # /usr/share/bcc/tools/funclatency btrfs_commit_inode_delayed_inode
Tracing 1 functions for "btrfs_commit_inode_delayed_inode"... Hit Ctrl-C to end.
nsecs : count distribution
0 -> 1 : 0 | |
2 -> 3 : 0 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 18 | |
512 -> 1023 : 120 | |
1024 -> 2047 : 50982 | |
2048 -> 4095 : 2569467 |******************** |
4096 -> 8191 : 4936402 |****************************************|
8192 -> 16383 : 1662380 |************* |
16384 -> 32767 : 656883 |***** |
32768 -> 65535 : 85409 | |
65536 -> 131071 : 21715 | |
131072 -> 262143 : 9719 | |
262144 -> 524287 : 5981 | |
524288 -> 1048575 : 857 | |
1048576 -> 2097151 : 293 | |
2097152 -> 4194303 : 220 | |
4194304 -> 8388607 : 255 | |
8388608 -> 16777215 : 153 | |
16777216 -> 33554431 : 56 | |
33554432 -> 67108863 : 6 | |
67108864 -> 134217727 : 1 | |
avg = 8533 nsecs, total: 85345432173 nsecs, count: 10000918 Using find ... -delete : # /usr/share/bcc/tools/funclatency btrfs_commit_inode_delayed_inode
Tracing 1 functions for "btrfs_commit_inode_delayed_inode"... Hit Ctrl-C to end.
nsecs : count distribution
0 -> 1 : 0 | |
2 -> 3 : 0 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 34 | |
512 -> 1023 : 95 | |
1024 -> 2047 : 1005784 |**** |
2048 -> 4095 : 8110338 |****************************************|
4096 -> 8191 : 672119 |*** |
8192 -> 16383 : 158329 | |
16384 -> 32767 : 42338 | |
32768 -> 65535 : 4667 | |
65536 -> 131071 : 3597 | |
131072 -> 262143 : 2860 | |
262144 -> 524287 : 216 | |
524288 -> 1048575 : 22 | |
1048576 -> 2097151 : 6 | |
2097152 -> 4194303 : 3 | |
4194304 -> 8388607 : 5 | |
8388608 -> 16777215 : 3 | |
avg = 3258 nsecs, total: 32585481993 nsecs, count: 10000416 You can see from the histogram that find spends 3258 nanoseconds on average in btrfs_commit_inode_delayed_inode but dentls2 spends 8533 nanoseconds in the function. Also the histogram shows that overall io_uring threads spend at least twice as long waiting on the lock which the majority of calls taking 4096-8091 nanoseconds versus the majority in find taking 2048-4095 nanoseconds. Find is single-threaded and isn't contending for the lock, whereas `dentls2 is multi-threaded (due to the uring) which produces lock contention and the delays that are experienced are reflected in the analysis. Conclusion All in all, on modern systems (as of writing this) there is less and less you can do in software to make this go faster than it is set to go. It used to be reading a large buffer from the disk you could compound an expensive IO call down into one large sequential read, instead of seeky IO which small getdents() buffers could typically end up being. Also due to other improvements there are smaller overheads to just invoking system calls and major improvements in sequential/random IO access times that eliminate the big IO bottlenecks we used to experience. On my systems, this problem has become memory/cpu bound. Theres a single-accessor problem on (at least) BTRFS which limits the speed you can go to a single cpu/programs worth of unlinks per directory at a time. Trying to batch the IO's yields at best minor improvements even in ideal circumstances of using tmpfs and typically is worse on a real-world filesystem. To top it off, we really dont have this problem anymore -- gone are the days of 10 million files taking 4 hours to remove. Just do something simple like find ... -delete . No amount of optimization I tried seemed to yield major performance improvements worth the coding (or analysis) over a default simple setup. Original Answer Whilst a major cause of this problem is ext3 performance with millions of files, the actual root cause of this problem is different. When a directory needs to be listed readdir() is called on the directory which yields a list of files. readdir is a posix call, but the real Linux system call being used here is called 'getdents'. Getdents list directory entries by filling a buffer with entries. The problem is mainly down to the fact that that readdir() uses a fixed buffer size of 32Kb to fetch files. As a directory gets larger and larger (the size increases as files are added) ext3 gets slower and slower to fetch entries and additional readdir's 32Kb buffer size is only sufficient to include a fraction of the entries in the directory. This causes readdir to loop over and over and invoke the expensive system call over and over. For example, on a test directory I created with over 2.6 million files inside, running "ls -1|wc-l" shows a large strace output of many getdent system calls. $ strace ls -1 | wc -l
brk(0x4949000) = 0x4949000
getdents(3, /* 1025 entries */, 32768) = 32752
getdents(3, /* 1024 entries */, 32768) = 32752
getdents(3, /* 1025 entries */, 32768) = 32760
getdents(3, /* 1025 entries */, 32768) = 32768
brk(0) = 0x4949000
brk(0x496a000) = 0x496a000
getdents(3, /* 1024 entries */, 32768) = 32752
getdents(3, /* 1026 entries */, 32768) = 32760
... Additionally the time spent in this directory was significant. $ time ls -1 | wc -l
2616044
real 0m20.609s
user 0m16.241s
sys 0m3.639s The method to make this a more efficient process is to call getdents manually with a much larger buffer. This improves performance significantly. Now, you're not supposed to call getdents yourself manually so no interface exists to use it normally (check the man page for getdents to see!), however you can call it manually and make your system call invocation way more efficient. This drastically reduces the time it takes to fetch these files. I wrote a program that does this. /* I can be compiled with the command "gcc -o dentls dentls.c" */
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <err.h>
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
struct linux_dirent {
long d_ino;
off_t d_off;
unsigned short d_reclen;
char d_name[256];
char d_type;
};
static int delete = 0;
char *path = NULL;
static void parse_config(
int argc,
char **argv)
{
int option_idx = 0;
static struct option loptions[] = {
{ "delete", no_argument, &delete, 1 },
{ "help", no_argument, NULL, 'h' },
{ 0, 0, 0, 0 }
};
while (1) {
int c = getopt_long(argc, argv, "h", loptions, &option_idx);
if (c < 0)
break;
switch(c) {
case 0: {
break;
}
case 'h': {
printf("Usage: %s [--delete] DIRECTORY\n"
"List/Delete files in DIRECTORY.\n"
"Example %s --delete /var/spool/postfix/deferred\n",
argv[0], argv[0]);
exit(0);
break;
}
default:
break;
}
}
if (optind >= argc)
errx(EXIT_FAILURE, "Must supply a valid directory\n");
path = argv[optind];
}
int main(
int argc,
char** argv)
{
parse_config(argc, argv);
int totalfiles = 0;
int dirfd = -1;
int offset = 0;
int bufcount = 0;
void *buffer = NULL;
char *d_type;
struct linux_dirent *dent = NULL;
struct stat dstat;
/* Standard sanity checking stuff */
if (access(path, R_OK) < 0)
err(EXIT_FAILURE, "Could not access directory");
if (lstat(path, &dstat) < 0)
err(EXIT_FAILURE, "Unable to lstat path");
if (!S_ISDIR(dstat.st_mode))
errx(EXIT_FAILURE, "The path %s is not a directory.\n", path);
/* Allocate a buffer of equal size to the directory to store dents */
if ((buffer = calloc(dstat.st_size*3, 1)) == NULL)
err(EXIT_FAILURE, "Buffer allocation failure");
/* Open the directory */
if ((dirfd = open(path, O_RDONLY)) < 0)
err(EXIT_FAILURE, "Open error");
/* Switch directories */
fchdir(dirfd);
if (delete) {
printf("Deleting files in ");
for (int i=5; i > 0; i--) {
printf("%u. . . ", i);
fflush(stdout);
sleep(1);
}
printf("\n");
}
while (bufcount = syscall(SYS_getdents, dirfd, buffer, dstat.st_size*3)) {
offset = 0;
dent = buffer;
while (offset < bufcount) {
/* Don't print thisdir and parent dir */
if (!((strcmp(".",dent->d_name) == 0) || (strcmp("..",dent->d_name) == 0))) {
d_type = (char *)dent + dent->d_reclen-1;
/* Only print files */
if (*d_type == DT_REG) {
printf ("%s\n", dent->d_name);
if (delete) {
if (unlink(dent->d_name) < 0)
warn("Cannot delete file \"%s\"", dent->d_name);
}
totalfiles++;
}
}
offset += dent->d_reclen;
dent = buffer + offset;
}
}
fprintf(stderr, "Total files: %d\n", totalfiles);
close(dirfd);
free(buffer);
exit(0);
} Whilst this does not combat the underlying fundamental problem (lots of files, in a filesystem that performs poorly at it). It's likely to be much, much faster than many of the alternatives being posted. As a forethought, one should remove the affected directory and remake it after. Directories only ever increase in size and can remain poorly performing even with a few files inside due to the size of the directory. Edit: I've cleaned this up quite a bit. Added an option to allow you to delete on the command line at runtime and removed a bunch of the treewalk stuff which, honestly looking back was questionable at best. Also was shown to produce memory corruption. You can now do dentls --delete /my/path New results. Based off of a directory with 1.82 million files. ## Ideal ls Uncached
$ time ls -u1 data >/dev/null
real 0m44.948s
user 0m1.737s
sys 0m22.000s
## Ideal ls Cached
$ time ls -u1 data >/dev/null
real 0m46.012s
user 0m1.746s
sys 0m21.805s
### dentls uncached
$ time ./dentls data >/dev/null
Total files: 1819292
real 0m1.608s
user 0m0.059s
sys 0m0.791s
## dentls cached
$ time ./dentls data >/dev/null
Total files: 1819292
real 0m0.771s
user 0m0.057s
sys 0m0.711s Was kind of surprised this still works so well! | {
"source": [
"https://serverfault.com/questions/183821",
"https://serverfault.com",
"https://serverfault.com/users/46760/"
]
} |
184,072 | I know how to create a command which a given user can execute via sudo . I have a given command I want to allow any user to be able to execute via sudo without entering a password. What would I put in my /etc/sudoers file in order to make that happen? | A section like this in your sudoers is probably what you want. Cmnd_Alias NAMEOFTHIS=/usr/bin/program
ALL ALL=NOPASSWD: NAMEOFTHIS | {
"source": [
"https://serverfault.com/questions/184072",
"https://serverfault.com",
"https://serverfault.com/users/11086/"
]
} |
184,524 | This is a Canonical Question about IPv6 and NAT Related: How does IPv6 subnetting work and how does it differ from IPv4 subnetting? How can I 'dip my toes' into dynamic IPv6 network addressing? IPv6 without nat but what about an isp change? So our ISP has set up IPv6 recently, and I've been studying what the transition should entail before jumping into the fray. I've noticed three very important issues: Our office NAT router (an old Linksys BEFSR41) does not support IPv6. Nor does any newer router, AFAICT. The book I'm reading about IPv6 tells me that it makes NAT "unnecessary" anyway. If we're supposed to just get rid of this router and plug everything directly to the Internet, I start to panic. There's no way in hell I'll put our billing database (With lots of credit card information!) on the internet for everyone to see. Even if I were to propose setting up Windows' firewall on it to allow only 6 addresses to have any access to it at all, I still break out in a cold sweat. I don't trust Windows, Windows' firewall, or the network at large enough to even be remotely comfortable with that. There's a few old hardware devices (ie, printers) that have absolutely no IPv6 capability at all. And likely a laundry list of security issues that date back to around 1998. And likely no way to actually patch them in any way. And no funding for new printers. I hear that IPv6 and IPSEC are supposed to make all this secure somehow, but without physically separated networks that make these devices invisible to the Internet, I really can't see how. I can likewise really see how any defences I create will be overrun in short order. I've been running servers on the Internet for years now and I'm quite familiar with the sort of things necessary to secure those, but putting something Private on the network like our billing database has always been completely out of the question. What should I be replacing NAT with, if we don't have physically separate networks? | First and foremost, there is nothing to fear from being on a public IP allocation, so long as your security devices are configured right. What should I be replacing NAT with, if we don't have physically separate networks? The same thing we've been physically separating them with since the 1980's, routers and firewalls. The one big security gain you get with NAT is that it forces you into a default-deny configuration. In order to get any service through it, you have to explicitly punch holes. The fancier devices even allow you to apply IP-based ACLs to those holes, just like a firewall. Probably because they have 'Firewall' on the box, actually. A correctly configured firewall provides exactly the same service as a NAT gateway. NAT gateways are frequently used because they're easier to get into a secure config than most firewalls. I hear that IPv6 and IPSEC are supposed to make all this secure somehow, but without physically separated networks that make these devices invisible to the Internet, I really can't see how. This is a misconception. I work for a University that has a /16 IPv4 allocation, and the vast, vast majority of our IP address consumption is on that public allocation. Certainly all of our end-user workstations and printers. Our RFC1918 consumption is limited to network devices and certain specific servers where such addresses are required. I would not be surprised if you just shivered just now, because I certainly did when I showed up on my first day and saw the post-it on my monitor with my IP address. And yet, we survive. Why? Because we have an exterior firewall configured for default-deny with limited ICMP throughput. Just because 140.160.123.45 is theoretically routeable, does not mean you can get there from wherever you are on the public internet. This is what firewalls were designed to do. Given the right router configs, and different subnets in our allocation can be completely unreachable from each other. You do can do this in router tables or firewalls. This is a separate network and has satisfied our security auditors in the past. There's no way in hell I'll put our billing database (With lots of credit card information!) on the internet for everyone to see. Our billing database is on a public IPv4 address, and has been for its entire existence, but we have proof you can't get there from here. Just because an address is on the public v4 routeable list does not mean it is guaranteed to be delivered. The two firewalls between the evils of the Internet and the actual database ports filter out the evil. Even from my desk, behind the first firewall, I can't get to that database. Credit-card information is one special case. That's subject to the PCI-DSS standards, and the standards state directly that servers that contain such data have to be behind a NAT gateway 1 . Ours are, and these three servers represent our total server usage of RFC1918 addresses. It doesn't add any security, just a layer of complexity, but we need to get that checkbox checked for audits. The original "IPv6 makes NAT a thing of the past" idea was put forward before the Internet boom really hit full mainstream. In 1995 NAT was a workaround for getting around a small IP allocation. In 2005 it was enshrined in many Security Best Practices document, and at least one major standard (PCI-DSS to be specific). The only concrete benefit NAT gives is that an external entity performing recon on the network doesn't know what the IP landscape looks like behind the NAT device (though thanks to RFC1918 they have a good guess), and on NAT-free IPv4 (such as my work) that isn't the case. It's a small step in defense-in-depth, not a big one. The replacement for RFC1918 addresses are what are called Unique Local Addresses. Like RFC1918, they don't route unless peers specifically agree to let them route. Unlike RFC1918, they are (probably) globally unique. IPv6 address translators that translate a ULA to a Global IP do exist in the higher range perimeter gear, definitely not in the SOHO gear yet. You can survive just fine with a public IP address. Just keep in mind that 'public' does not guarantee 'reachable', and you'll be fine. 2017 update In the past few months, Amazon aws has been adding IPv6 support. It has just been added to their amazon-vpc offering, and their implementation gives some clues as to how large scale deployments are expected to be done. You are given a /56 allocation (256 subnets). The allocation is a fully routeable subnet. You are expected to set your firewall-rules ( security-groups ) appropriately restrictive. There is no NAT, it's not even offered, so all outbound traffic will come from the actual IP address of the instance. To add one of the security benefits of NAT back in, they are now offering an Egress-only Internet Gateway . This offers one NAT-like benefit: Subnets behind it can't be directly accessed from the internet. Which provides a layer of defense-in-depth, in case a misconfigred firewall rule accidentally allows inbound traffic. This offering does not translate the internal address into a single address the way NAT does. Outbound traffic will still have the source IP of the instance that opened the connection. Firewall operators looking to whitelist resources in the VPC will be better off whitelisting netblocks, rather than specific IP addresses. Routeable does not always mean reachable . 1 : The PCI-DSS standards changed in October 2010, the statement mandating RFC1918 addresses was removed, and 'network isolation' replaced it. | {
"source": [
"https://serverfault.com/questions/184524",
"https://serverfault.com",
"https://serverfault.com/users/10118/"
]
} |
184,957 | For me was picking the wrong option in raid setup after a disk failure. A funny weekend indeed. In my defense, it's my first Junior job: +20 experience point.
Just curious about yours, so maybe I can learn from mistakes made by other people too. So what about you? | Nothing of note from a technical perspective but it took me at least a decade of my career to realise that IT wasn't an end in itself but a simple requirement to better serve my company and customers. This change in attitude stopped me from being that typical know-it-all IT dick that we've all come across and really start to help those around me. This was the start of what has been a far more rewarding (for all parties) period of my career that has made me genuinely happy, liked and fulfilled. So that would be my biggest mistake - wasting the 90's by thinking the world revolved around me. | {
"source": [
"https://serverfault.com/questions/184957",
"https://serverfault.com",
"https://serverfault.com/users/23452/"
]
} |
185,153 | I'm writing an application that makes connections to SSH servers. It doesn't need anything specific from the server (except running under GNU/Linux). I need SSH servers for running my application tests. I was wondering, is there some kind of free and open to anyone SSH servers? Maybe it's an idea for a new service :) | Check out the Free Shell Accounts list. | {
"source": [
"https://serverfault.com/questions/185153",
"https://serverfault.com",
"https://serverfault.com/users/48053/"
]
} |
185,253 | Can I delete everything in /var/log ? Or should I only delete files (recursively) in /var/log but leave folders? Does anyone have a good rm command line? (My admin skills leave me nervous.) Note: I am using Debian. I am not sure what version. | Instead of deleting the files you should rotate them, e. g. using logrotate . You never know when you'll actually need the logs from some time ago, so it's better to archive them (up to a reasonable age, e. g. 3 months). logrotate can compress your old log files so they don't occupy a lot of disk space. | {
"source": [
"https://serverfault.com/questions/185253",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
185,703 | I have a user on my linux server who has sudo. I want to edit the crontab of another user. I'm new to this though and don't understand what the man pages are telling me yet. Man crontab tells me I can use this format for the crontab command: crontab [ -u user ] { -l | -r [ -i ] | -e } But what does that mean? I want to edit the crontab of a user named jake so I tried crontab jake -e
crontab [jake] -e
crontab [-u jake] -e And I get the same error every time: "usage error: no arguments permitted after this option" So what do I type in to edit jake's crontab? | Try crontab -e -u jake You will need to be root for this to work. | {
"source": [
"https://serverfault.com/questions/185703",
"https://serverfault.com",
"https://serverfault.com/users/55604/"
]
} |
185,868 | I'm trying to set up the EC2 API tools and I'm stuck because I cannot figure out where I can obtain the file pointed to by the EC2_PRIVATE_KEY environment variable (I believe I have the EC2_CERT). Of the multitude of different access credentials visible in the EC2 user interface, which one do I need to make the command line tools work? | Ok, turns out that I need to generate a new X.509 certificate, and then I'll be able to download both the EC2_PRIVATE_KEY and the EC2_CERT files. This link proved useful: http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2 | {
"source": [
"https://serverfault.com/questions/185868",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
185,894 | Apache is receiving requests at port :80 and proxying them to Jetty at port :8080 The proxy server received an invalid response from an upstream server
The proxy server could not handle the request GET /. My dilemma: Everything works fine normally (fast requests, few seconds or few tens of seconds long requests are processed ok ). Problems occur when request processing takes long (few minutes?). If I issue request instead directly to Jetty at port :8080 the request is processed OK. So problem is likely to sit somewhere between Apache and Jetty where I am using mod_proxy . How to solve this? I have already tried some "tricks" related to KeepAlive settings, without luck. Here is my current configuration, any suggestions? #keepalive Off ## I have tried this, does not help
#SetEnv force-proxy-request-1.0 1 ## I have tried this, does not help
#SetEnv proxy-nokeepalive 1 ## I have tried this, does not help
#SetEnv proxy-initial-not-pooled 1 ## I have tried this, does not help
KeepAlive 20 ## I have tried this, does not help
KeepAliveTimeout 600 ## I have tried this, does not help
ProxyTimeout 600 ## I have tried this, does not help
NameVirtualHost *:80
<VirtualHost _default_:80>
ServerAdmin [email protected]
ServerName www.mydomain.fi
ServerAlias mydomain.fi mydomain.com mydomain www.mydomain.com
ProxyRequests On
ProxyVia On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://www.mydomain.fi:8080/ retry=1 acquire=3000 timeout=600
ProxyPassReverse / http://www.mydomain.fi:8080/
RewriteEngine On
RewriteCond %{SERVER_NAME} !^www\.mydomain\.fi
RewriteRule /(.*) http://www.mydomain.fi/$1 [redirect=301L]
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost> Here is also the debug log from a failing request: 74.125.43.99 - - [29/Sep/2010:20:15:40 +0300] "GET /?wicket:bookmarkablePage=newWindow:com.mydomain.view.application.reports.SaveReportPage HTTP/1.1" 502 355 "https://www.mydomain.fi/?wicket:interface=:0:2:::" "Mozilla/5.0 (Windows; U; Windows NT 6.1; fi; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10"
[Wed Sep 29 20:20:40 2010] [error] [client 74.125.43.99] proxy: error reading status line from remote server www.mydomain.fi, referer: https://www.mydomain.fi/?wicket:interface=:0:2:::
[Wed Sep 29 20:20:40 2010] [error] [client 74.125.43.99] proxy: Error reading from remote server returned by /, referer: https://www.mydomain.fi/?wicket:interface=:0:2::: | I have solved the problem. The Keepalive=On should be inserted into ProxyPass config line: ProxyPass / http://www.dom.fi:8080/ retry=1 acquire=3000 timeout=600 Keepalive=On See that Keepalive=On there? It is critical ;) | {
"source": [
"https://serverfault.com/questions/185894",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
186,057 | I'm using MySQL and I need to create an account that can connect from either the localhost or from another server, i.e. 10.1.1.1. So I am doing: CREATE USER 'bob'@'localhost' IDENTIFIED BY 'password123';
CREATE USER 'bob'@'10.1.1.1' IDENTIFIED BY 'password123';
GRANT SELECT, INSERT, UPDATE, DELETE on MyDatabse.* to 'bob'@'localhost', 'bob'@'10.1.1.1'; This works fine, but is there any more elegant way to create a user account that is linked to multiple IPs or does it need to be done this way? My main worry is that in the future, permissions will be updated for one 'bob' account but not the other. | If you want to restrict to host and do not want to specify based on a subnet or wildcard using % , that's the only way to do it. More details are available in the MySQL documentation . I am still trying to find ways to eliminate overhead when managing authentication to large MySQL installations and have yet to find a perfect solution. | {
"source": [
"https://serverfault.com/questions/186057",
"https://serverfault.com",
"https://serverfault.com/users/11495/"
]
} |
186,445 | Can data included in a URL be considered secure if the connection is made over HTTPS? For example, if a user clicks a link in an email that points to https://mysite.com?mysecretstring=1234 would it be possible for an attacker to grab "mysecretstring" from the URL? | The entire HTTP request (and response) is encrypted, including the URL. But yes, there is a way an attacker could grab the full URL: through the Referer header. If there is any external file (Javscript, CSS, etc.) which is not over HTTPS, the full URL could be sniffed in the Referer header. Same if the user click on a link in the page that leads to an HTTP (no SSL) page. Also, DNS requests are not encrypted, so an attacker could know the user is going to mysite.com. | {
"source": [
"https://serverfault.com/questions/186445",
"https://serverfault.com",
"https://serverfault.com/users/13947/"
]
} |
186,965 | I've added these rules to mime.types : application/x-font-ttf ttf;
font/opentype otf;
application/vnd.ms-fontobject eot;
font/x-woff woff; Now the Content-Type header is being set properly per each of those. My only issue now is that Firefox requires Access-Control-Allow-Origin. I have googled this answer and added this to my server directive: location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
} but now my fonts aren't being served at all. Instead the error.log reports that it's trying to open them on the local filesystem.. 2010/10/02 22:20:21 [error] 1641#0:
*15 open() "/usr/local/nginx/html/fonts/mgopenmodernabold-webfont.woff"
failed (2: No such file or directory),
client: 69.164.216.142, se rver:
static.arounds.org, request: "HEAD
/fonts/mgopenmodernabold-webfont.woff
HTTP/1.1", host: "static.arounds.org" Any ideas what could be off with the syntax? Do I need to explicitly add a rule saying don't try to open it locally or what? EDIT : I think the problem is that I'm serving 2 different locations now. And instead of that I should do the regex check inside of the main one then feed the header. | Woot! Got it.. It was pretty much what I suspected in my edit, I had to basically do the regex filename check in my sole location {} instead of making an alternative one. location / {
root /www/site.org/public/;
index index.html;
if ($request_filename ~* ^.*?/([^/]*?)$)
{
set $filename $1;
}
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
add_header Access-Control-Allow-Origin *;
}
} | {
"source": [
"https://serverfault.com/questions/186965",
"https://serverfault.com",
"https://serverfault.com/users/16850/"
]
} |
186,966 | I have SQL Server Management Studio (for SQL Server Express R2) on my pc, and I'd like to export a few databases for use by a website that's running on a server with SQL Server Web. However, when I right click one of the databases in management studio and go to Tasks > Export Data ... a window comes up warning me that when migrating to another instance of SQL Server, I should use the Copy Database Wizard. However, I can't find this wizard in management studio. When I right click on the database and go to Tasks, there is no option for Copy Database. I must have done something wrong. Has anyone experienced this problem before? Thanks, Andrew | Woot! Got it.. It was pretty much what I suspected in my edit, I had to basically do the regex filename check in my sole location {} instead of making an alternative one. location / {
root /www/site.org/public/;
index index.html;
if ($request_filename ~* ^.*?/([^/]*?)$)
{
set $filename $1;
}
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
add_header Access-Control-Allow-Origin *;
}
} | {
"source": [
"https://serverfault.com/questions/186966",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
187,025 | I am trying to create a webserver that serves PHP scripts. Currently, it works as follows: The client requests /index.php?test=value The server invokes php index.php The server feeds the HTTP request headers as STDIN to the PHP process The server reads the output of php from STDOUT and returns it to the client All of this is working except that the parameters are not being passed to the PHP script because: var_dump($_GET); returns: array(0) { } How do $_GET parameters get passed to the PHP binary when it is invoked? | Which PHP binary are you using? The CLI or CGI? I suspect you need a CGI version of the binary for PHP to properly handle accept the environment variables and POST data if you pass that. The php-cgi binary implements the CGI interface, which allows you to pass parameters on the command line: php-cgi -f index.php left=1058 right=1067 class=A language=English Which end up in $_GET : Array
(
[left] => 1058
[right] => 1067
[class] => A
[language] => English
) You may want to read up on how CGI works so you can implement that in your web server. Ref: RFC3875 | {
"source": [
"https://serverfault.com/questions/187025",
"https://serverfault.com",
"https://serverfault.com/users/30745/"
]
} |
187,302 | We have a suite of Windows Services running on our servers which perform a bunch of automated tasks independently of one another, with the exception of one service which looks after the other services. In the event that one of the services should fail to respond or hang, this service attempts to restart the service and, if an exception is thrown during the attempt, emails the support team instead, so that they can restart the service themselves. Having done a little research, I've come across a few 'solutions' which range from the workaround mentioned in KB907460 to giving the account under which the service is running administrator rights. I'm not comfortable with either of these methods - I don't understand the consequences of the first method as outlined in Microsoft's knowledge base article, but I definitely don't want to give administrator access to the account under which the service is running. I've taken a quick look through the Local Security Policy and other than the policy which defines whether or not an account can log on as a service, I can't see anything else which looks like it refers to services. We're running this on Server 2003 and Server 2008, so any ideas or pointers would be graciously received! Clarification: I don't want to grant the ability to start/stop/restart ALL services to a given user or group - I want to be able to grant the permission to do so on specific services only, to a given user or group. Further Clarification: The servers I need to grant these permissions on do not belong to a domain - they are two internet-facing servers which receive files, process them and send them on to third parties, as well as serving a couple of websites, so Active Directory Group Policy isn't possible. Sorry that I didn't make this clearer. | There doesn't appear to be a GUI-based way of doing this unless you're joined to a domain - at least not one I could find anywhere - so I did a bit more digging and I've found an answer that works for our situation. I didn't understand what the string representation meant in the knowledge base article, but doing a bit of digging led me to discover that it's SDDL syntax. Further digging led me to this article by Alun Jones which explains how to get the security descriptor for a service and what each bit means. MS KB914392 has more details. To append to the service's existing security descriptor, use sc sdshow "Service Name" to get the existing descriptor. If this is a plain old .NET Windows Service - as is the case with ours - the security descriptor should look something like this: D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOC
RRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)S:(AU;FA
;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD) We needed to grant permissions RP (to start the service), WP (to stop the service), DT (to pause/continue the service) and LO (to query the service's current status). This could be done by adding our service account to the Power Users group, but I only want to grant individual access to the account under which the maintenance service runs. Using runas to open a command prompt under the service account, I ran whoami /all which gave me the SID of the service account, and then constructed the additional SDDL below: (A;;RPWPDTLO;;;S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx) This then gets added to the D: section of the SDDL string above: D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOC
RRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)(A;;RPWP
DTLO;;;S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx)S:(AU;FA;CCDCLCSWRPWPDTLOC
RSDRCWDWO;;;WD) This is then applied to the service using the sc sdset command (before the S: text): sc sdset "Service Name" D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;
CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU
)(A;;RPWPDTLO;;;S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx)S:(AU;FA;CCDCLCSW
RPWPDTLOCRSDRCWDWO;;;WD) If all goes according to plan, the service can then be started, stopped, paused and have it's status queried by the user defined by the SID above. | {
"source": [
"https://serverfault.com/questions/187302",
"https://serverfault.com",
"https://serverfault.com/users/43335/"
]
} |
187,355 | when i execute batch file on cmd screen the command in the batch appear on the screen example :- batch file :- @echo off.
command1
command2 when i execute it on cmd the following appear on screen :- c:\user > command1
c:\user >command2 i dont to appear anything when i execute batch file | If I understand your question correctly, I think you want to separate commands on individual lines... @echo off
command1
command2 Is this what you are looking for? | {
"source": [
"https://serverfault.com/questions/187355",
"https://serverfault.com",
"https://serverfault.com/users/52749/"
]
} |
188,037 | I can use uname and cat /proc/version but all I get is the kernel version. How do I know whether I'm running RHEL4 or 5.5 or such? | You can find out in the file /etc/issue cat /etc/issue And also on redhat based systems, you can find out in /etc/redhat-release cat /etc/redhat-release | {
"source": [
"https://serverfault.com/questions/188037",
"https://serverfault.com",
"https://serverfault.com/users/26228/"
]
} |
188,054 | I read, that APC causes Apache to throw Segmentation faults. Is this error still valid? I'm asking because we have a web application (PHP) that is used at a local fair and currently has a lot of usage. We have no problems with memory consumption (currently 1 GB out of 8GB used) but we have quite a lot of CPU usage. Would an opcode cache help reduce CPU usage? Or should I increase the apache number of apache forks? | You can find out in the file /etc/issue cat /etc/issue And also on redhat based systems, you can find out in /etc/redhat-release cat /etc/redhat-release | {
"source": [
"https://serverfault.com/questions/188054",
"https://serverfault.com",
"https://serverfault.com/users/1127/"
]
} |
188,056 | I'm replacing a Windows Server 2003 based DNS server (for an office LAN) with a new Windows 2008 based server. The old DNS server used the internal IP address of our Netgear router as a forwarder, but this doesn't work with the Win 2008 server. Is there another address I should be using instead of the router as the forwarder? Currently I've just copied in the DNS server addresses of our ISP from the router settings which seems to work, but I guess these could change any time. Some forums suggest using 4.2.2.1 / 4.2.2.2 as forwarding servers - is this correct? Thanks | You can find out in the file /etc/issue cat /etc/issue And also on redhat based systems, you can find out in /etc/redhat-release cat /etc/redhat-release | {
"source": [
"https://serverfault.com/questions/188056",
"https://serverfault.com",
"https://serverfault.com/users/2155/"
]
} |
188,177 | My question is why is the shorthand for 32-bit x86 when the shorthand for 64-bit is x64? I'm guessing it has something to do with the days of 386s and 486s, when the 32-bit processors all ended in 86, but surely there were processors that didn't end in 86 and were still 32-bit? Does anyone know the history of this or can direct me to a good source of info? | Well, there once was a chip called 8086, with a cheaper version called 8088 that was used in a personal computer called IBM PC. An improved version of that chip was made and called 80186, though that wasn't a very popular version. However, an improved improved version was then made, and called 80286. Now, that was a very popular chip, in particular because it was used in a computer called IBM PC AT. Later, Intel, which created and sold the 8086, 8088, 80186 and 80286 chips, all of which had a 16 bits architecture, saw the need to create a 32 bits chip to compete with similar offerings by others. To take advantage of its incumbent position, it made the new chip capable of running software made for the previously mentioned chips. Naturally, Intel called this new chip the 80386. By then there were lots of computers using various versions of the Intel chips, and there were also non-Intel chips that were compatible with the Intel ones. So people started referring to them as 80x86. After a while, Intel launched a new chip, but it decided to drop the 80, so it became the 486 instead of 80486. Likewise, people were dropping the "80" from the front of "80x86", and calling this stuff just x86. Now, I'm pretty sure some will come and say Intel branded their chips x86 at such and such time, which they did, but I don't care. The fact is that the ever-increasing middle digit gave rise to 80x86, and x86 came from that -- even if 80186 and 80286 were not 32 bits. So, once Intel finally went 64 bits, what did it call its new architecture? Right! IA64! :-) It also retroactively renamed the x86 to IA32, so to speak. Only IA64 was not compatible with x86, I mean, IA32, so everyone ignored it. And then came AMD, which decided the market wanted a 64 bits CPU that was compatible, to the extent possible, with the x86 family. As a marketing appeal, they called it the "x86-64" family, and they were hugely succesful. So much so that Intel ended up grudgingly following with their own 64 bits CPU based on x86. Later, because people are lazy, the x86-64 became known simply as the x64. So, in answer to your question, because x64 is shorter than x86-64. | {
"source": [
"https://serverfault.com/questions/188177",
"https://serverfault.com",
"https://serverfault.com/users/5075/"
]
} |
188,350 | What are VLANs? What problems do they solve? I'm helping a friend learn basic networking, as he's just become the sole sysadmin at a small company. I've been pointing him at various questions/answers on Serverfault relating to various networking topics, and noticed a gap - there doesn't appear to be an answer which explains from first principles what VLANs are. In the spirit of How does Subnetting Work , I thought it would be useful to have a question with a canonical answer here. Some potential topics to cover in an answer: What are VLANs? What problems were they intended to solve? How did things work before VLANs? How do VLANs relate to subnets? What are SVIs? What are trunk ports and access ports? What is VTP? EDIT: to be clear, I already know how VLANs work - I just think that Serverfault should have an answer that covers these questions. Time permitting, I'll be submitting my own answer as well. | Virtual LANs (VLANs) are an abstraction to permit a single physical network to emulate the functionality of multiple parallel physical networks. This is handy because there may be situations where you need the functionality of multiple parallel physical networks but you'd rather not spend the money on buying parallel hardware. I'll be speaking about Ethernet VLANs in this answer (even though other networking technologies can support VLANs) and I won't be diving deeply into every nuance. A Contrived Example and a Problem As a purely contrived example scenario, imagine you own an office building that you lease to tenants. As a benefit of the lease, each tenant will get live Ethernet jacks in each room of the office. You buy a Ethernet switch for each floor, wire them up to jacks in each office on that floor, and wire all the switches together. Initially, you lease space to two different tenants-- one on the floor 1 and one on 2. Each of these tenants configures their computers w/ static IPv4 addresses. Both tenants use different TCP/IP subnets and everything seems to work just fine. Later, a new tenant rents half of floor 3 and brings up one of these new-fangled DHCP servers. Time passes and the 1st floor tenant decides to jump on the DHCP bandwagon, too. This is the point when things start to go awry. The floor 3 tenants report that some of their computers are getting "funny" IP addresses from a machine that isn't their DHCP server. Soon, the floor 1 tenants report the same thing. DHCP is a protocol that takes advantage of the broadcast capability of Ethernet to allow client computers to obtain IP addresses dynamically. Because the tenants are all sharing the same physical Ethernet network they share the same broadcast domain. A broadcast packet sent from any computer in the network will flood out all the switch ports to every other computer. The DHCP servers on floors 1 and 3 will receive all requests for IP address leases and will, effectively, duel to see who can answer first. This is clearly not the behavior you intend your tenants to experience. This is the behavior, though, of a "flat" Ethernet network w/o any VLANs. Worse still, a tenant on floor 2 acquires this "Wireshark" software and reports that, from time to time, they see traffic coming out of their switch that references computers and IP addresses that they've never heard of. One of their employees has even figured out that he can communicate with these other computers by changing the IP address assigned to his PC from 192.168.1.38 to 192.168.0.38! Presumably, he's just a few short steps away from performing "unauthorized pro-bono system administration services" for one of the other tenants. Not good. Potential Solutions You need a solution! You could just pull the plugs between the floors and that would cut off all unwanted communication! Yeah! That's the ticket... That might work, except that you have a new tenant who will be renting half of the basement and the unoccupied half of floor 3. If there isn't a connection between the floor 3 switch and the basement switch the new tenant won't be able to get communication between their computers that will be spread around both of their floors. Pulling the plugs isn't the answer. Worse still, the new tenant is bringing yet another one of these DHCP servers! You flirt with the idea of buying physically separate sets of Ethernet switches for each tenant, but seeing as how your building has 30 floors, any of which can be subdivided up to 4 ways, the potential rats nest of floor-to-floor cables between massive numbers of parallel Ethernet switches could be a nightmare, not to mention expensive. If only there was a way to make a single physical Ethernet network act like it was multiple physical Ethernet networks, each with its own broadcast domain. VLANs to the Rescue VLANs are an answer to this messy problem. VLANs permit you to subdivide an Ethernet switch into logically disparate virtual Ethernet switches. This allows a single Ethernet switch to act as though it's multiple physical Ethernet switches. In the case of your subdivided floor 3, for example, you could configure your 48 port switch such that the lower 24 ports are in a given VLAN (which we'll call VLAN 12) and the higher 24 ports are in a given VLAN (which we'll call VLAN 13). When you create the VLANs on your switch you'll have to assign them some type of VLAN name or number. The numbers I'm using here are mostly arbitrary, so don't worry about what specific numbers I choose. Once you've divided the floor 3 switch into VLANs 12 and 13 you find that the new floor 3 tenant can plug in their DHCP server to one of the ports assigned to VLAN 13 and a PC plugged into a port assigned to VLAN 12 doesn't get an IP address from the new DHCP server. Excellent! Problem solved! Oh, wait... how do we get that VLAN 13 data down to the basement? VLAN Communication Between Switches Your half-floor 3 and half-basement tenant would like to connect computers in the basement to their servers on floor 3. You could run a cable directly from one of the ports assigned to their VLAN in the floor 3 switch to the basement and life would be good, right? In the early days of VLANs (pre-802.1Q standard) you might do just that. The entire basement switch would be, effectively, part of VLAN 13 (the VLAN you've opted to assign to the new tenant on floor 3 and the basement) because that basement switch would be "fed" by a port on floor 3 that's assigned to VLAN 13. This solution would work until you rent the other half of the basement to your floor 1 tenant who also wants to have communication between their 1st floor and basement computers. You could split the basement switch using VLANs (into, say, VLANS 2 and 13) and run a cable from floor 1 to a port assigned to VLAN 2 in the basement, but you better judgement tells you that this could quickly become a rat's nest of cables (and is only going to get worse). Splitting switches using VLANs is good, but having to run multiple cables from other switches to ports which are members of different VLANs seems messy. Undoubtedly, if you had to divide the basement switch 4 ways between tenants who also had space on higher floors you'd use 4 ports on the basement switch just to terminate "feeder" cables from upstairs VLANs. It should now be clear that some type of generalized method of moving traffic from multiple VLANs between switches on a single cable is needed. Just adding more cables between switches to support connections between different VLANs isn't a scalable strategy. Eventually, with enough VLANs, you'll be eating up all the ports on your switches with these inter-VLAN / inter-switch connections. What's needed is a way to carry the packets from multiple VLANs along a single connection-- a "trunk" connection between switches. Up to this point, all the switch ports we've talked about are called "access" ports. That is, these ports are dedicated to accessing a single VLAN. The devices plugged into these ports have no special configuration themselves. These devices don't "know" that any VLANs are present. Frames the client devices send are delivered to the switch which then takes care of making sure that the frame is only sent to ports assigned as members of the VLAN assigned to the port where the frame entered the switch. If a frame enters the switch on a port assigned as a member of VLAN 12 then the switch will only send that frame out ports that are members of VLAN 12. The switch "knows" the VLAN number assigned to a port from which it receives a frame and somehow knows to only deliver this frame out ports of the same VLAN. If there were some way for a switch to share the VLAN number associated with a given frame to other switches then the other switch could properly handle delivering that frame only to the appropriate destination ports. This is what the 802.1Q VLAN tagging protocol does. (It's worth noting that, prior to 802.1Q, some vendors made up their own standards for VLAN tagging and inter-switch trunking. For the most part these pre-standard methods have all been supplanted by 802.1Q.) When you have two VLAN-aware switches connected to each other and you want those switches to deliver frames between each other to the proper VLAN you connect those switches using "trunk" ports. This involves changing the configuration of a port on each switch from "access" mode to "trunk" mode (in a very basic configuration). When a port is configured in trunk mode each frame that the switch sends out that port will have a "VLAN tag" included in the frame. This "VLAN tag" wasn't part of the original frame that the client sent. Rather, this tag is added by the sending switch prior to sending the frame out the trunk port. This tag denotes the VLAN number associated with the port from which the frame originated. The receiving switch can look at the tag to determine which VLAN the frame originated from and, based on that information, forward the frame out only ports that are assigned to the originating VLAN. Because the devices connected to "access" ports aren't aware that VLANs are being used the "tag" information must be stripped from the frame before it's sent out a port configured in access mode. This stripping of the tag information causes the entire VLAN trunking process to be hidden from client devices since the frame they receive will not bear any VLAN tag information. Before you configure VLANs in real life I'd recommend configuring a port for trunk mode on a test switch and monitoring the traffic being sent out that port using a sniffer (like Wireshark). You can create some sample traffic from another computer, plugged into an access port, and see that the frames leaving the trunk port will, in fact, be larger than the frames being send by your test computer. You'll see the VLAN tag information in the frames in Wireshark. I find that it's worth actually seeing what happens in a sniffer. Reading up on the 802.1Q tagging standard is also a decent thing to do at this point (especially since I'm not talking about things like "native VLANs" or double-tagging). VLAN Configuration Nightmares and the Solution As you rent more and more space in your building the number of VLANs grows. Each time you add a new VLAN you find that you have to logon to increasingly more Ethernet switches and add that VLAN to the list. Wouldn't it be great if there were some method by which you could add that VLAN to a single configuration manifest and have it automatically populate the VLAN configuration of each switch? Protocols like Cisco's proprietary "VLAN Trunking Protocol" (VTP) or the standards-based "Multiple VLAN Registration Protocol" (MVRP-- previously spelled GVRP) fulfill this function. In a network using these protocols a single VLAN creation or deletion entry results in protocol messages being sent to all switches in the network. That protocol message communicates the change in VLAN configuration to the rest of the switches which, in turn, modify their VLAN configurations. VTP and MVRP aren't concerned with which specific ports are configured as access ports for specific VLANs, but rather are useful in communicating the creation or deletion of VLANs to all the switches. When you've gotten comfortable with VLANs you'll probably want to go back and read about "VLAN pruning", which is associated with protocols like VTP and MVRP. For now it's nothing to be tremendously concerned with. (The VTP article on Wikipedia has a nice diagram that explains VLAN pruning and the benefits therewith.) When Do You Use VLANs In Real Life? Before we go much further it's important to think about real life rather than contrived examples. In lieu of duplicating the text of another answer here I'll refer you to my answer re: when to create VLANs . It's not necessarily "beginner-level", but it's worth taking a look at now since I'm going to make reference to it briefly before moving back to a contrived example. For the "tl;dr" crowd (who surely have all stopped reading at this point, anyway), the gist of that link above is: Create VLANs to make broadcast domains smaller or when you want to segregate traffic for some particular reason (security, policy, etc). There aren't really any other good reasons to use VLANs. In our example we're using VLANs to limit broadcast domains (to keep protocols like DHCP working right) and, secondarily, because we want isolation between the various tenants' networks. An Aside re: IP Subnets and VLANs Generally speaking there is a typically a one-to-one relationship between VLANs and IP subnets as a matter of convenience, to facilitate isolation, and because of how the ARP protocol works. As we saw at the beginning of this answer two different IP subnets can be used on the same physical Ethernet without issue. If you're using VLANs to shrink broadcast domains you won't want to share the same VLAN with two different IP subnets since you'll be combining their ARP and other broadcast traffic. If you're using VLANs to segregate traffic for security or policy reasons then you also probably won't want to combine multiple subnets in the same VLAN since you'll be defeating the purpose of isolation. IP uses a broadcast-based protocol, Address Resolution Protocol (ARP), to map IP addresses onto physical (Ethernet MAC) addresses. Since ARP is broadcast based, assigning different parts of the same IP subnet to different VLANs would be problematic because hosts in one VLAN wouldn't be able to receive ARP replies from hosts in the other VLAN, since broadcasts aren't forwarded between VLANs. You could solve this "problem" by using proxy-ARP but, ultimately, unless you have a really good reason to need to split an IP subnet across multiple VLANs it's better not to do so. One Last Aside: VLANs and Security Finally, it's worth noting that VLANs aren't a great security device. Many Ethernet switches have bugs that permit frames originating from one VLAN to be sent out ports assigned to another VLAN. Ethernet switch manufacturers have worked hard to fix these bugs, but it's doubtful that there will ever be a completely bug free implementation. In the case of our contrived example the floor 2 employee who is moments away from providing free systems administration "services" to another tenant might be stopped from doing so by isolating his traffic into a VLAN. He might also figure out how to exploit bugs in the switch firmware, though, to allow his traffic to "leak" out onto another tenant's VLAN as well. Metro Ethernet providers are relying, increasingly, on VLAN tagging functionality and the isolation that switches provide. It's not fair to say that there's no security offered by using VLANs. It is fair to say, though, that in situations with untrusted Internet connections or DMZ networks it's probably better to use physically separate switches to carry this "touchy" traffic rather than VLANs on switches that also carry your trusted "behind the firewall" traffic. Bringing Layer 3 into the Picture So far everything this answer has talked about relates to layer 2-- Ethernet frames. What happens if we start bringing layer 3 into this? Let's go back to the contrived building example. You've embraced VLANs opted to configure each tenant's ports as members of separate VLANs. You've configured trunk ports such that each floor's switch can exchange frames tagged with the originating VLAN number to the switches on the floor above and below. One tenant can have computers spread across multiple floors but, because of your adept VLAN configuring skills, these physically distributed computers can all appear to be part of the same physical LAN. You're so full of your IT accomplishments that you decide to start offering Internet connectivity to your tenants. You buy a fat Internet pipe and a router. You float the idea to all your tenants and two of them immediately buy-in. Luckily for you your router has three Ethernet ports. You connect one port to your fat Internet pipe, another port to a switch port assigned for access to the first tenant's VLAN, and the other to a port assigned for access to the second tenant's VLAN. You configure your router's ports with IP addresses in each tenant's network and the tenants start accessing the Internet through your service! Revenue increases and you're happy. Soon, though, another tenant decides to get onto your Internet offering. You're out of ports on your router, though. What to do? Fortunately you bought a router that supports configuring "virtual sub-interfaces" on its Ethernet ports. In short this functionality allows the router to receive and interpret frames tagged with originating VLAN numbers, and to have virtual (that is, non-physical) interfaces configured with IP addresses appropriate for each VLAN it will communicate with. In effect this permits you to "multiplex" a single Ethernet port on the router such that it appears to function as multiple physical Ethernet ports. You attach your router to a trunk port on one of your switches and configure virtual sub-interfaces corresponding to each tenant's IP addressing scheme. Each virtual sub-interface is configured with the VLAN number assigned to each Customer. When a frame leaves the trunk port on the switch, bound for the router, it will carry a tag with the originating VLAN number (since it's a trunk port). The router will interpret this tag and treat the packet as though it arrived on a dedicated physical interface corresponding to that VLAN. Likewise, when the router sends a frame to the switch in response to a request it will add a VLAN tag to the frame such that the switch knows to which VLAN the response frame should be delivered. In effect, you've configured the router to "appear" as a physical device in multiple VLANs while only using a single physical connection between the switch and the router. Routers on Sticks and Layer 3 Switches Using virtual sub-interfaces you've been able to sell Internet connectivity to all your tenants without having to buy a router that has 25+ Ethernet interfaces. You're fairly happy with your IT accomplishments so you respond positively when two of your tenants come to you with a new request. These tenants have opted to "partner" on a project and they want to allow access from client computers in one tenant's office (one given VLAN) to a server computer in the other tenant's office (another VLAN). Since they're both Customers of your Internet service it's a fairly simple change of an ACL in your core Internet router (on which there is a virtual sub-interface configured for each of these tenant's VLANs) to allow traffic to flow between their VLANs as well as to the Internet from their VLANs. You make the change and send the tenants on their way. The next day you receive complaints from both tenants that access between the client computers in one office to the server in the second office is very slow. The server and client computers both have gigabit Ethernet connections to your switches but the files only transfer at around 45Mbps which, coincidentally, is roughly half of the speed with which your core router connects to its switch. Clearly the traffic flowing from the source VLAN to the router and back out from the router to the destination VLAN is being bottlenecked by the router's connection to the switch. What you've done with your core router, allowing it to route traffic between VLANs, is commonly known as "router on a stick" (an arguably stupidly whimsical euphemism). This strategy can work well, but traffic can only flow between the VLANs up to the capacity of the router's connection to the switch. If, somehow, the router could be conjoined with the "guts" of the Ethernet switch itself it could route traffic even faster (since the Ethernet switch itself, per the manufacturer's spec sheet, is capable of switching over 2Gbps of traffic). A "layer 3 switch" is an Ethernet switch that, logically speaking, contains a router buried inside itself. I find it tremendously helpful to think of a layer 3 switch as having a tiny and fast router hiding inside the switch. Further, I would advise you to think about the routing functionality as a distinctly separate function from the Ethernet switching function that the layer 3 switch provides. A layer 3 switch is, for all intents and purposes, two distinct devices wrapped up in a single chassis. The embedded router in a layer 3 switch is connected to the switch's internal switching fabric at a speed that, typically, allows for routing of packets between VLANs at or near wire-speed. Analogously to the virtual sub-interfaces you configured on your "router on a stick" this embedded router inside the layer 3 switch can be configured with virtual interfaces that "appear" to be "access" connections into each VLAN. Rather than being called virtual sub-interfaces these logical connections from the VLANs into the embedded router inside a layer 3 switch are called Switch Virtual Interfaces (SVIs). In effect, the embedded router inside a layer 3 switch has some quantity of "virtual ports" that can be "plugged in" to any of the VLANs on the switch. The embedded router performs the same way as a physical router except that it typically doesn't have all of the same dynamic routing protocol or access-control list (ACL) features as a physical router (unless you've bought a really nice layer 3 switch). The embedded router has the advantage, however, of being very fast and not having a bottleneck associated with a physical switch port that it's plugged into. In the case of our example here with the "partnering" tenants you might opt to obtain a layer 3 switch, plug it into trunk ports such that traffic from both Customers VLANs reaches it, then configure SVIs with IP addresses and VLAN memberships such that it "appears" in both Customers VLANs. Once you've done that it's just a matter of tweaking the routing table on your core router and the embedded router in the layer 3 switch such that traffic flowing between the tenants' VLANs is routed by the embedded router inside the layer 3 switch versus the "router on a stick". Using a layer 3 switch doesn't mean that there still won't be bottlenecks associated with the bandwidth of the trunk ports that interconnect your switches. This is an orthogonal concern to those that VLANs address, though. VLANs have nothing to do with bandwidth problems. Typically bandwidth problems are solved by either obtaining higher-speed inter-switch connections or using link-aggregation protocols to "bond" several lower-speed connections together into a virtual higher-speed connection. Unless all the devices creating frames to be routed by the embedded router inside the later 3 switch are, themselves, plugged into ports directly on the layer 3 switch you still need to worry about the bandwidth of the trunks between the switches. A layer 3 switch isn't a panacea, but it's typically faster than a "router on a stick". Dynamic VLANs Lastly, there is a function in some switches to provide dynamic VLAN membership. Rather than assigning a given port to be an access port for a given VLAN the port's configuration (access or trunk, and for which VLANs) can be altered dynamically when a device is connected. Dynamic VLANs are a more advanced topic but knowing that the functionality exists can be helpful. The functionality varies between vendors but typically you can configure dynamic VLAN membership based on the MAC address of the connected device, 802.1X authentication status of the device, proprietary and standards-based protocols (CDP and LLDP, for example, to allow IP phones to "discover" the VLAN number for voice traffic), IP subnet assigned to the client device, or Ethernet protocol type. | {
"source": [
"https://serverfault.com/questions/188350",
"https://serverfault.com",
"https://serverfault.com/users/388/"
]
} |
188,429 | Is it possible to check that if the ports are open for the remote system on ubuntu server? I should able to check if a port(eg:ssh) on my machine is open for the remote machine. | use good old telnet: [user@lappie ~]$ telnet host 22
Trying ip.adr.tld ...
Connected to host (ip.addr.tld).
Escape character is '^]'.
SSH-2.0-OpenSSH_5.1p1 Debian-5 this is a successful attempt. An unsuccessful one should look like this; [user@lappie ~]$ telnet host 23
Trying ip.adr.tld ...
telnet: connect to address ip.adr.tld: Connection refused
telnet: Unable to connect to remote host: Connection refused or with nmap [user@lappie ~]$ nmap host
Starting Nmap 5.21 ( http://nmap.org ) at 2010-10-07 11:25 CEST
Nmap scan report for host (ip.adr.tld)
Host is up (0.0052s latency).
rDNS record for ip.adr.tld : host.domain.tld
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
3000/tcp open ppp
5666/tcp open nrpe
Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds | {
"source": [
"https://serverfault.com/questions/188429",
"https://serverfault.com",
"https://serverfault.com/users/53864/"
]
} |
188,597 | If I have multiple network interfaces (here: 2) on a Linux machine (here: Debian Lenny).
How do I see, over what network interface (NIC) a route to a specific destination host is going and what source IP address is used by default? I have though of using ping -I nic1 desthost.example.com
ping -I nic2 desthost.example.com too see if both ways are possible. (Here: Both ways are possible) I looked up the routing table ip route show But it's quite complex, so I thought, there must by a small simple tool, to just tell me: "To destination host desthost.example.com it takes interface nicX and source IP address 10.0.0.1" What is the simplest way of getting this information? (And I'd rather not use tcpdump and set the interfaces in promiscous mode.) Thanks. | Use ip route get <ip> . | {
"source": [
"https://serverfault.com/questions/188597",
"https://serverfault.com",
"https://serverfault.com/users/56403/"
]
} |
188,729 | I have a large and growing set of text files, which are all quite small (less than 100 bytes). I want to diff each possible pair of files and note which are duplicates. I could write a Python script to do this, but I'm wondering if there's an existing Linux command-line tool (or perhaps a simple combination of tools) that would do this? Update (in response to mfinni comment): The files are all in a single directory, so they all have different filenames. (But they all have a filename extension in common, making it easy to select them all with a wildcard.) | There's the fdupes . But I usually use a combination of find . -type f -exec md5sum '{}' \; | sort | uniq -d -w 36 | {
"source": [
"https://serverfault.com/questions/188729",
"https://serverfault.com",
"https://serverfault.com/users/20205/"
]
} |
189,014 | I'd like to reset all graphs for a certain host in Munin . Anyone who knows how I can do this? | Munin data is stored in Round Robin Database files (.rrd). These are stored under /var/lib/munin. Each host and hostgroup will have it's own subdirectory under /var/lib/munin Delete the .rrd files under the hostname in question, and your data will be zeroed out. Graphs will be re-generated after a few minutes. | {
"source": [
"https://serverfault.com/questions/189014",
"https://serverfault.com",
"https://serverfault.com/users/37237/"
]
} |
189,070 | What firewall port(s) need to be open to allow access to external git repositories? | Specifically TCP 9418, no need for UDP. Reference . | {
"source": [
"https://serverfault.com/questions/189070",
"https://serverfault.com",
"https://serverfault.com/users/37403/"
]
} |
189,282 | I've noticed that a lot of admins change the default ssh port. Is there any rational reason to do so? | It isn't as useful as some people claim, but it will at least reduce the impact on your log files as many brute force login attempts only use the default port rather than scanning to see if SSH is listening elsewhere. Some attacks will scan for SSH elsewhere though, so it is no silver bullet. If your server is going to be a shared host of some sort, rather than just serving the needs of your projects, using a non-default port can be a pain as you will have to explain it to your users over and over and over and over when they forget and their client programs fail to connect to port 22! Another possible problem with SSH on a non-standard port is if you encounter a client with a restrictive out-going filter set, who can't connect to your custom port because their filter only allows, for example, ports 22, 53, 80 and 443 to be the destination for new out-going connections. This is uncommon, but certainly not unheard of. On a similar matter, some ISPs may see encrypted traffic on a port other than those where it is generally expected (port 443 or HTTPS, 22 for SSH, and so on) as an attempt to hide a P2P connection and throttle (or block) the connection in an inconvenient manner. I personally keep SSH on the standard port for convenience. As long as the usual precautions are taken (strong password/key policy, restricting root logins, ...) it need not be a worry and the log file growth issue when you are hit with a brute force attack can be mitigated using tools such as fial2ban to temporarily block hosts that give too many bad sets of authentication credentials in a given space of time. Whatever port you chose, if you do move away from 22, make sure it is below 1024. Under most Unix-a-like setups in their default config, only root (or users in the root group) can listen on ports below 1024, but any user can listen on the higher ports. Running SSH on a higher port increases the chance of a rogue (or hacked) user managing to crash your SSH daemon and replace it with their own or a proxy. | {
"source": [
"https://serverfault.com/questions/189282",
"https://serverfault.com",
"https://serverfault.com/users/46519/"
]
} |
189,320 | How can I monitor what logrotate is doing in Ubuntu? Can the activity of logrotate be monitored? | cat /var/lib/logrotate/status To verify if a particular log is indeed rotating or not and to check the last date and time of its rotation, check the /var/lib/logrotate/status file. This is a neatly formatted file that contains the log file name and the date on which it was last rotated. Taken From: https://www.digitalocean.com/community/articles/how-to-manage-log-files-with-logrotate-on-ubuntu-12-10 | {
"source": [
"https://serverfault.com/questions/189320",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
189,627 | So I did a chmod -x chmod . How I can fix this problem? How do I give execute rights back to chmod? | In Linux: /lib/ld-linux.so.2 /bin/chmod +x /bin/chmod http://www.slideshare.net/cog/chmod-x-chmod | {
"source": [
"https://serverfault.com/questions/189627",
"https://serverfault.com",
"https://serverfault.com/users/30776/"
]
} |
189,633 | This may be a silly question. I have a colocated server that is running server 2008 R2. I use it for IIS, MailServer, SQL Server and MYSQL. I also have some custom dlls installed for some of my classic asp work. Here is my concern... How do I back this thing up?
If it were a hyper-v system I could just backup the image, but its not. I want to have a Norton Ghost like image so that I can restore the server at anytime?
Also, if there is a way to ghost a server (colocated- through RDP), can I then use the image with different hardware and expect it to work? Lets say the server explodes and I buy different hardware from Dell. Please advise. | In Linux: /lib/ld-linux.so.2 /bin/chmod +x /bin/chmod http://www.slideshare.net/cog/chmod-x-chmod | {
"source": [
"https://serverfault.com/questions/189633",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
189,649 | I'm fairly new to Unicies. With the advent of GNU/Linux and BSDs, what are the reasons for companies to prefer AIX, Solaris and other commercial systems? | Well some software is specifically written for AIX/Solaris etc. while some 'money men' don't trust 'free' software (I've witnessed this myself, someone told me I HAD to spend money on OS!). But most of the time it's to get 24/365 support. | {
"source": [
"https://serverfault.com/questions/189649",
"https://serverfault.com",
"https://serverfault.com/users/49790/"
]
} |
189,655 | I can easily pickup whether a server is Win2k3, 2k8, standard edition, enterprise edition, x86, x64, but I cannot find a way of determining if it's Release 1 or 2. HP Systems Insight Manager somehow manages it. Arghhh! | Well some software is specifically written for AIX/Solaris etc. while some 'money men' don't trust 'free' software (I've witnessed this myself, someone told me I HAD to spend money on OS!). But most of the time it's to get 24/365 support. | {
"source": [
"https://serverfault.com/questions/189655",
"https://serverfault.com",
"https://serverfault.com/users/56640/"
]
} |
189,729 | When running service iptables status on 2 CentOS server, one server has policy ACCEPT in Chain INPUT , Chain FORWARD , and Chain OUTPUT another server has policy DROP in Chain INPUT and Chain FORWARD ; while policy ACCEPT in Chain OUTPUT What the meaning of policy ACCEPT and policy DROP ? ...and how to change from policy ACCEPT to policy DROP and from policy DROP to policy ACCEPT ? | ACCEPT means that the default policy for that chain, if there are no matching rules, is to allow the traffic. DROP does the opposite. The following rule will change the policy for inbound traffic to DROP: iptables --policy INPUT DROP The manpage for iptables should be able to give you the rest of the info you would need to make other policy changes as necessary. | {
"source": [
"https://serverfault.com/questions/189729",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
]
} |
189,739 | The Setup I have an OpenVPN server that acts as a central router. It is configured with "topology subnet" command. Clients are Debian Linux nodes and each have one (or more) subnets directly connected to them. The objective is for any client connected to the VPN to be able to access the subnets connected behind each other client. In order to spread the routing information, we have installed Quagga on the clients and on the server. This works fine using the OSPF daemon. Routing is enabled on all the clients and the server as well. Routing table The routing table on the server is the following : Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.2.10.1 10.8.0.4 255.255.255.255 UGH 20 0 0 tun0
192.168.100.0 10.8.0.4 255.255.255.0 UG 20 0 0 tun0
192.168.1.0 10.8.0.4 255.255.255.0 UG 20 0 0 tun0 The subnet I want to access is 192.168.100.0/24. The gateway in question responds perfectly fine and I can connect to it alright. I don't think this will be of any use but here is part of the client routing table : 10.2.10.1 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 Where things start going south Pinging from the server (10.8.0.1) to any hosts (including the VPN client interface) in the 192.168.100.0/24 subnet fails. If I tcpdump the tun interface on the VPN client, I see no relevant package. If I tcpdump the tun interface on the VPN server, I see the package in question being sent out. The real edgy thing is that when I traceroute to a valid IP in the 192.168.100.0 subnet, it doesn't discover any hops (there should be just one). If I traceroute directly to the next hop (10.8.0.4), it responds fine. I really hope I am being clear as this is quite a complex problem. I'll be happy to provide extra information at your request. | ACCEPT means that the default policy for that chain, if there are no matching rules, is to allow the traffic. DROP does the opposite. The following rule will change the policy for inbound traffic to DROP: iptables --policy INPUT DROP The manpage for iptables should be able to give you the rest of the info you would need to make other policy changes as necessary. | {
"source": [
"https://serverfault.com/questions/189739",
"https://serverfault.com",
"https://serverfault.com/users/3431/"
]
} |
189,940 | I need to reload my php.ini and there's nothing in the help dialog about restarting it. | Note : prepend sudo if not root Using SysV Init scripts directly: /etc/init.d/php-fpm restart # typical
/etc/init.d/php5-fpm restart # debian-style
/etc/init.d/php7.0-fpm restart # debian-style PHP 7 Using service wrapper script service php-fpm restart # typical
service php5-fpm restart # debian-style
service php7.0-fpm restart # debian-style PHP 7 Using Upstart (e.g. ubuntu): restart php7.0-fpm # typical (ubuntu is debian-based) PHP 7
restart php5-fpm # typical (ubuntu is debian-based)
restart php-fpm # uncommon Using systemd (newer servers): systemctl restart php-fpm.service # typical
systemctl restart php5-fpm.service # uncommon
systemctl restart php7.0-fpm.service # uncommon PHP 7 Or whatever the equivalent is on your system. | {
"source": [
"https://serverfault.com/questions/189940",
"https://serverfault.com",
"https://serverfault.com/users/8257/"
]
} |
190,067 | I'd like to set up an account on a linux server and make the account's password never expire. I'm having difficulties figuring it out with the passwd man page. Could someone please help me out? | To maximize password expiration: passwd -x 99999 username To disable account expiration: usermod -e '' username To do both with chage: chage -E -1 -M -1 username To set the system defaults, look at /etc/default/useradd | {
"source": [
"https://serverfault.com/questions/190067",
"https://serverfault.com",
"https://serverfault.com/users/427/"
]
} |
190,571 | To mount a network drive from the cmd prompt on windows I can do, for example: net use z: \\vboxsvr\somedrive How would I disconnect it from the cmd prompt? | net use z: /delete | {
"source": [
"https://serverfault.com/questions/190571",
"https://serverfault.com",
"https://serverfault.com/users/36175/"
]
} |
190,685 | First, the situation: I've got a Linux computer with two eSATA drive bays that accept removable SSD drives. I'm trying to write a little GUI application that makes it easier for the user to mount/unmount/format/backup/etc the drives that he puts into these bays. It all mostly works. One small problem, however, is that I don't know how to find out any information about what's on the inserted drive(s) until after the drives have been successfully mounted. So, for example, if the user inserts a drive that I can't mount (e.g. because it is unformatted, or formatted with an unexpected filesystem), all my app can say about it is "Drive failed to mount". This isn't very satisfactory, because if the drive is unformatted, the user will probably want to format it... but if the drive contains data from an unrecognized filesystem, the user will probably NOT want to format it.... or at least, I want to be able to warn him that by doing so he'll be erasing potentially valuable data. So my question is: is there any method for querying some basic information (especially filesystem-type) from a drive that doesn't require that the drive already be mounted? Or do I just have to try to mount it with various known filesystems until one of the mount attempts succeeds, and give a vague "be careful" message if none of them do? In case it matters, the paths I use to mount the drives in the drive bays are: /dev/disk/by-path/pci-0000:00:1f.2-scsi-2:0:0:0
/dev/disk/by-path/pci-0000:00:1f.2-scsi-1:0:0:0 | If the drives are unmounted there are several things you can do. You can use a command like fdisk -l or sfdisk -l to list the partitions. Just the partition type may give you some useful information if the partitions where setup correct.y # sfdisk -l
Disk /dev/sda: 4177 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 30 31- 248976 83 Linux
/dev/sda2 31 4176 4146 33302745 8e Linux LVM
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty If it is present on your system you can use the command vol_id against a partition to return some useful details (part of the udev package on Debian). This will generally tell you what filesystem is actually being used. # vol_id /dev/sda1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=32c44d53-9025-4d10-8f36-75c166547bd5
ID_FS_UUID_ENC=32c44d53-9025-4d10-8f36-75c166547bd5
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE= The command lshw -class disk will give you some details about the type of drive. You might want to use this if you are curious about the actual serial number of the drive. # lshw -class disk
*-disk
description: ATA Disk
product: VBOX HARDDISK
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 1.0
serial: VB169e93fb-d1e0fd97
size: 32GiB (34GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=000d39f8 If you are sure the there is a particular filesystem like ext2/3 on it then you can use the filesystem specific tune2fs tool to examine more details. # tune2fs -l /dev/sda1
tune2fs 1.41.3 (12-Oct-2008)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 8cbdf102-05c7-4ae4-96ea-681cf9b11914
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: filetype sparse_super
Default mount options: (none)
Filesystem state: not clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 124496
Block count: 248976
Reserved block count: 12448
Free blocks: 212961
Free inodes: 124467
First block: 1
Block size: 1024
Fragment size: 1024
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 4016
Inode blocks per group: 502
Last mount time: Thu Oct 7 15:34:42 2010
Last write time: Thu Oct 7 15:34:42 2010
Mount count: 4
Maximum mount count: 30
Last checked: Wed Sep 15 09:29:03 2010
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128 Another useful tool is lsblk . # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
└─sda1 8:1 0 30G 0 part
├─vg1-root (dm-0) 254:0 0 23.3G 0 lvm /
└─vg1-swap (dm-1) 254:1 0 1.9G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom If you have parted installed you can run a command like this parted /dev/sda print all
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 255MB 255MB primary ext2 boot
2 255MB 34.4GB 34.1GB primary lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1root: 32.6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 32.6GB 32.6GB ext3 Anyway past that I suggest you take a look at the udev or parted source. | {
"source": [
"https://serverfault.com/questions/190685",
"https://serverfault.com",
"https://serverfault.com/users/19340/"
]
} |
190,687 | I set up a Seagate DockStar with Debian Squeeze as a litte server in my home network. I'd like to access it from outside my own network now, so I need a VPN connection. BTW, I don't have a router with an integrated VPN server.
I already have a "big" Windows XP server running which I can access via a PPTP VPN tunnel. That was pretty easy, but now with Debian, I have some problems setting up the VPN connection. I installed pptpd via apt-get install pptpd already. This is my pptpd.conf: # TAG: ppp
# Path to the pppd program, default '/usr/sbin/pppd' on Linux
#
#ppp /usr/sbin/pppd
# TAG: option
# Specifies the location of the PPP options file.
# By default PPP looks in '/etc/ppp/options'
#
option /etc/ppp/pptpd-options
# TAG: debug
# Turns on (more) debugging to syslog
#
#debug
# TAG: stimeout
# Specifies timeout (in seconds) on starting ctrl connection
#
# stimeout 10
# TAG: noipparam
# Suppress the passing of the client's IP address to PPP, which is
# done by default otherwise.
#
#noipparam
# TAG: logwtmp
# Use wtmp(5) to record client connections and disconnections.
#
logwtmp
# TAG: bcrelay <if>
# Turns on broadcast relay to clients from interface <if>
#
#bcrelay eth1
# TAG: localip
# TAG: remoteip
# Specifies the local and remote IP address ranges.
#
# Any addresses work as long as the local machine takes care of the
# routing. But if you want to use MS-Windows networking, you should
# use IP addresses out of the LAN address space and use the proxyarp
# option in the pppd options file, or run bcrelay.
#
# You can specify single IP addresses seperated by commas or you can
# specify ranges, or both. For example:
#
# 192.168.0.234,192.168.0.245-249,192.168.0.254
#
# IMPORTANT RESTRICTIONS:
#
# 1. No spaces are permitted between commas or within addresses.
#
# 2. If you give more IP addresses than MAX_CONNECTIONS, it will
# start at the beginning of the list and go until it gets
# MAX_CONNECTIONS IPs. Others will be ignored.
#
# 3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238,
# you must type 234-238 if you mean this.
#
# 4. If you give a single localIP, that's ok - all local IPs will
# be set to the given one. You MUST still give at least one remote
# IP for each simultaneous client.
#
# (Recommended)
localip 192.168.0.120
remoteip 192.168.0.121-129
# or
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245 My DHCP server in the router is distributing IPs beginning with 192.168.0.2. My big server distributed IPs beginning at 192.168.0.121 to VPN clients (the server itself had the x.x.x.120 TP) - as I already wrote, on the big server VPN works, so I've just set localip and the remoteip range to those from the big server. My pptpd-options looks like this: # Authentication
# Name of the local system for authentication purposes
# (must match the second field in /etc/ppp/chap-secrets entries)
name pptpd
# Optional: domain name to use for authentication
# domain mydomain.net
# Strip the domain prefix from the username before authentication.
# (applies if you use pppd with chapms-strip-domain patch)
#chapms-strip-domain
# Encryption
# Debian: on systems with a kernel built with the package
# kernel-patch-mppe >= 2.4.2 and using ppp >= 2.4.2, ...
# {{{
refuse-pap
refuse-chap
refuse-mschap
# Require the peer to authenticate itself using MS-CHAPv2 [Microsoft
# Challenge Handshake Authentication Protocol, Version 2] authentication.
require-mschap-v2
# Require MPPE 128-bit encryption
# (note that MPPE requires the use of MSCHAP-V2 during authentication)
#require-mppe-128
# }}}
# Network and Routing
# If pppd is acting as a server for Microsoft Windows clients, this
# option allows pppd to supply one or two DNS (Domain Name Server)
# addresses to the clients. The first instance of this option
# specifies the primary DNS address; the second instance (if given)
# specifies the secondary DNS address.
# Attention! This information may not be taken into account by a Windows
# client. See KB311218 in Microsoft's knowledge base for more information.
#ms-dns 10.0.0.1
#ms-dns 10.0.0.2
# If pppd is acting as a server for Microsoft Windows or "Samba"
# clients, this option allows pppd to supply one or two WINS (Windows
# Internet Name Services) server addresses to the clients. The first
# instance of this option specifies the primary WINS address; the
# second instance (if given) specifies the secondary WINS address.
#ms-wins 10.0.0.3
#ms-wins 10.0.0.4
# Add an entry to this system's ARP [Address Resolution Protocol]
# table with the IP address of the peer and the Ethernet address of this
# system. This will have the effect of making the peer appear to other
# systems to be on the local ethernet.
# (you do not need this if your PPTP server is responsible for routing
# packets to the clients -- James Cameron)
proxyarp
# Debian: do not replace the default route
nodefaultroute
# Logging
# Enable connection debugging facilities.
# (see your syslog configuration for where pppd sends to)
#debug
# Print out all the option values which have been set.
# (often requested by mailing list to verify options)
#dump
# Miscellaneous
# Create a UUCP-style lock file for the pseudo-tty to ensure exclusive
# access.
lock
# Disable BSD-Compress compression
nobsdcomp
ms-dns 192.168.0.1
netmask 255.255.255.0
noipx
mtu 1490
mru 1490 In the chap-secrets file I registered one user. (like the following: - is this right?) netstat tells me that port 1723 is open and listened to by pptpd, as well as an nmap port scan from another computer does.
iptables isn't installed on the DockStar.
In my router, I'm forwarding every TCP or UDP connection to port 1723 to the DockStar's IP. I tried connecting with a Windoows XP, a Windows 7 and a Mac OS X client. All are not able to establish a connection. Mac OS X does only show a general error message, the Windows clients show "Error 619 - A connection with the remote computer could not be established.". The clients are configured to use MSCHAPv2 with the username and password set in the chap-secrets file. It doesn't matter if I try to connect to the server from my notebook in the same network or via my WWAN connection (while WiFi is turned off) - it doesn't work every time I try to connect. Does anybody have an idea what's wrong with the server's configuration and knows how I can get it working? Thanks in advance, iYassin | If the drives are unmounted there are several things you can do. You can use a command like fdisk -l or sfdisk -l to list the partitions. Just the partition type may give you some useful information if the partitions where setup correct.y # sfdisk -l
Disk /dev/sda: 4177 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 30 31- 248976 83 Linux
/dev/sda2 31 4176 4146 33302745 8e Linux LVM
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty If it is present on your system you can use the command vol_id against a partition to return some useful details (part of the udev package on Debian). This will generally tell you what filesystem is actually being used. # vol_id /dev/sda1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=32c44d53-9025-4d10-8f36-75c166547bd5
ID_FS_UUID_ENC=32c44d53-9025-4d10-8f36-75c166547bd5
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE= The command lshw -class disk will give you some details about the type of drive. You might want to use this if you are curious about the actual serial number of the drive. # lshw -class disk
*-disk
description: ATA Disk
product: VBOX HARDDISK
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 1.0
serial: VB169e93fb-d1e0fd97
size: 32GiB (34GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=000d39f8 If you are sure the there is a particular filesystem like ext2/3 on it then you can use the filesystem specific tune2fs tool to examine more details. # tune2fs -l /dev/sda1
tune2fs 1.41.3 (12-Oct-2008)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 8cbdf102-05c7-4ae4-96ea-681cf9b11914
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: filetype sparse_super
Default mount options: (none)
Filesystem state: not clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 124496
Block count: 248976
Reserved block count: 12448
Free blocks: 212961
Free inodes: 124467
First block: 1
Block size: 1024
Fragment size: 1024
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 4016
Inode blocks per group: 502
Last mount time: Thu Oct 7 15:34:42 2010
Last write time: Thu Oct 7 15:34:42 2010
Mount count: 4
Maximum mount count: 30
Last checked: Wed Sep 15 09:29:03 2010
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128 Another useful tool is lsblk . # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
└─sda1 8:1 0 30G 0 part
├─vg1-root (dm-0) 254:0 0 23.3G 0 lvm /
└─vg1-swap (dm-1) 254:1 0 1.9G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom If you have parted installed you can run a command like this parted /dev/sda print all
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 255MB 255MB primary ext2 boot
2 255MB 34.4GB 34.1GB primary lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1root: 32.6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 32.6GB 32.6GB ext3 Anyway past that I suggest you take a look at the udev or parted source. | {
"source": [
"https://serverfault.com/questions/190687",
"https://serverfault.com",
"https://serverfault.com/users/57050/"
]
} |
191,015 | Is there a way (in Windows) to delineate the roles my login has on the box I'm logged in to? The machine is joined to a domain, if that makes a difference. | If you are ready to do some coding, you can use following commands to get the information you want. When executed separately these commands give the information in bits and pieces. C:\>net localgroup This will give list of all local groups. Iterate on this list and execute C:\>net localgroup <groupName> This will give list of all members (users and groups which are added to this local group). To get the list of all domain groups, you are part of, you can execute C:\>net user <username> /domain Look for Global Group memberships in the output.
PS: /domain is a keyword. Don't replace it with your domain name. Now if your user name or the Global Groups are part of the members list of any local group (output of second command), then it is the role assigned to you. Unfortunately, these commands output more data / text than what you want. So you will need to write some code (in your favorite language or even .bat file) to parse and combine the output of above commands. It will be worth writing a program if you repeatedly need to find roles of a user. | {
"source": [
"https://serverfault.com/questions/191015",
"https://serverfault.com",
"https://serverfault.com/users/49596/"
]
} |
191,140 | I know of Putty. I currently use rxvt (via Cygwin). Is there a more "integrated" terminal program for Windows out there?
e.g. something closer to KDE's kconsole -- where I can have multiple shells all tabbed within the same window. etc. | So far as I know, Putty is the best open-source non-commercial SSH client for Windows. For tabbed sessions there is http://puttycm.free.fr/cms/ You could also look at commercial programs such as Reflection for Unix and SecureCRT. (Edit:) They both offer tabbed sessions. Another option might be Putty + screen ( man screen )? (Edit:) Summary of programs suggested in this & other answers and comments In no particular order. Putty RGB Putty + PuttyCM RGB Putty + screen RGB Reflection RGB - $120 SecureCRT RGB - $99 Anzio Lite RGB - $40 mRemote gWaldo mRemoteNG Mircea Vutcovici Kitty - a Putty fork UniDyne Poderosa Cypher ssh from Cygwin OpenSSH] Steven Monai Absolute Telnet Adrien MobaXterm miguelo Prices for commercial products are indicative only, check before choosing I thought it would be useful to have a concise list. For votes, see also below. | {
"source": [
"https://serverfault.com/questions/191140",
"https://serverfault.com",
"https://serverfault.com/users/57189/"
]
} |
191,299 | Is there a way to mount the different disks as one directory?
Assuming I have some disks with ext4 partitions: /dev/sda1 1Tb mounted as /store1
/dev/sda2 2Tb mounted as /store2
/dev/sdb1 2Tb mounted as /store3
/dev/sdb2 2Tb mounted as /store4 I would like to have /storeall with 7Tb space, merging them as one logical directory, so I can fill that with one rsync command. Is it possible on Linux? Which filesystem should I use? | mhddfs is exactly what you are looking for: http://romanrm.net/mhddfs You can mount like this: mhddfs /mnt/a/,/mnt/b/,/mnt/c/ /storeall/ where /mnt/a/ , /mnt/b/ , and /mnt/c/ are three different mount points which can be from three different hard drives. You can unmount like this: fusermount -u /storeall If one disk fails you only lose the files that was stored on that particular disk. If your data is important for you and you would like your data to survive a disk failure you should consider a RAID setup instead (search for mdadm). edit: PS! The devices you mount can even have different filesystems! | {
"source": [
"https://serverfault.com/questions/191299",
"https://serverfault.com",
"https://serverfault.com/users/43265/"
]
} |
191,537 | With your typical Linux shutdown command, what is the difference between halting the system and powering off the system? | Halting involves stopping all CPUs on the system. Powering off involves sending an ACPI command to signal the PSU to disconnect main power. | {
"source": [
"https://serverfault.com/questions/191537",
"https://serverfault.com",
"https://serverfault.com/users/21307/"
]
} |
191,785 | I ran dpkg-buildpackage after getting a apt-get source nginx of a backports version of nginx and modifying debian/rules to include the uwsgi module. The last results of the command were: dpkg-deb: building package `nginx' in `../nginx_0.7.67-3~bpo50+1_i386.deb'.
dpkg-deb: building package `nginx-dbg' in `../nginx-dbg_0.7.67-3~bpo50+1_i386.deb'.
signfile nginx_0.7.67-3~bpo50+1.dsc
gpg: keyring `/home/shogun/.gnupg/secring.gpg' created
gpg: skipped "Faidon Liambotis <[email protected]>": secret key not available
gpg: [stdin]: clearsign failed: secret key not available
dpkg-genchanges >../nginx_0.7.67-3~bpo50+1_i386.changes
dpkg-genchanges: warning: the current version (0.7.67-3~bpo50+1) is smaller than the previous one (0.7.67-3)
dpkg-genchanges: not including original source code in upload
dpkg-buildpackage: binary and diff upload (original source NOT included)
dpkg-buildpackage: warning: Failed to sign .dsc and .changes file It complains that because I'm not the original maintainer of the package, my key didnt match. Is this really necessary and if so how can I make it use my keys to do the gpg matching? | PGP-signing Debian packages is not necessary if you built them for your own private use. It's just the common authentication method for (official) Debian developers when they upload new packages into the Debian "unstable" branch. To avoid the error message just use: dpkg-buildpackage -uc -us (see also the manpage of dpkg-buildpackage) | {
"source": [
"https://serverfault.com/questions/191785",
"https://serverfault.com",
"https://serverfault.com/users/16850/"
]
} |
191,799 | I am on Debian Lenny and I had nginx 0.7.65 from lenny-backports installed. I needed the uwsgi module so I added the deb-src for lenny-backports and did apt-get source nginx . This grabbed the 0.7.67-3. I followed this guide to a T: http://brandonkonkle.com/blog/2010/sep/14/django-uwsgi-and-nginx/ and then did dpkg -i nginx*.deb as per the instructions. It doesn't seem like it replaced 0.7.65 because I get this: (Reading database ... 27253 files and directories currently installed.)
Preparing to replace nginx 0.7.67-3~bpo50+1 (using nginx_0.7.67-3~bpo50+1_i386.deb) ...
Unpacking replacement nginx ...
Preparing to replace nginx-dbg 0.7.67-3~bpo50+1 (using nginx-dbg_0.7.67-3~bpo50+1_i386.deb) ...
Unpacking replacement nginx-dbg ...
Setting up nginx (0.7.67-3~bpo50+1) ...
Trying a soft restart
Processing triggers for man-db ...
Setting up nginx-dbg (0.7.67-3~bpo50+1) ... And, if I try to /etc/init.d/nginx stop and start again, it wont obey. I think I may have caused a conflict of some sorts? The dpkg -i was supposed to install 0.7.67, and I have 2 deb files after I did the dpkg-buildpackage: nginx_0.7.67-3~bpo50+1_i386.deb and nginx-dbg_0.7.67-3~bpo50+1_i386.deb Where did I go wrong? Could someone explain why nginx doesnt obey at all now? I can't stop it or start it. If I go into aptitude it tells me that 0.7.67 is the installed version. | PGP-signing Debian packages is not necessary if you built them for your own private use. It's just the common authentication method for (official) Debian developers when they upload new packages into the Debian "unstable" branch. To avoid the error message just use: dpkg-buildpackage -uc -us (see also the manpage of dpkg-buildpackage) | {
"source": [
"https://serverfault.com/questions/191799",
"https://serverfault.com",
"https://serverfault.com/users/16850/"
]
} |
192,155 | Computer processors moved from 32bit to 64bit. Why have IPs moved from 32bit to 128bit (skipping 64bit) ? EDIT: I did not intend to make a direct comparison. Just curious why IPs skipped 64bit. | The two are unrelated. The decisions around how to structure IPV6 are myriad. There's a lot of info at the IPv6 Wikipedia article . Basically, the 128-bit address space of IPv6 gives us such a massive address space that we are unlikely to ever use all of it (2^128 addresses, or 3.4*10^38). The larger address space also allows for a better hierarchical model of addressing, because CIDR and similar "hacks" are no longer necessary for routing. The address space allows a separation of a 64 bit host address and 64 bit network address, and host address can be self-configured. With more space, we have more addresses, and it's easier to organize them efficiently. IPv4 is kind of like a cluttered 1-bedroom apartment, and IPv6 is a giant warehouse in which we can set up everything in a much more organized fashion. | {
"source": [
"https://serverfault.com/questions/192155",
"https://serverfault.com",
"https://serverfault.com/users/55910/"
]
} |
192,335 | Is there a way to monitor the output of a linux command without having to type it over and over. I want to do something like: tail -f file.txt But for a command like: ps aux | grep httpd | wc Thanks! | watch 'ps aux | grep httpd | wc' | {
"source": [
"https://serverfault.com/questions/192335",
"https://serverfault.com",
"https://serverfault.com/users/57531/"
]
} |
192,409 | This is a basic question - in the movie "The Social Network" there are several scenes when the young Facebook staff is watching the PHP/Apache server logs on in their TERMINAL in real time. I'm familiar with how to do this in a RUBY/RoR environment - but with a standard LAMP Apache/PHP environment, how to do actively monitor your server's actions in real time? I'm guessing there's an easy way to do this in Terminal. | maybe they use tail -f on the access log? | {
"source": [
"https://serverfault.com/questions/192409",
"https://serverfault.com",
"https://serverfault.com/users/68142/"
]
} |
192,720 | Wireshark | Windows I want to search a packet capture of SMTP traffic for specific addresses/messages. Normally, I just sort the info column and browse but it would be nice if I could just run a search or filter for the specific string I'm looking for. Is there a way to do this in Wireshark? | Open Edit→Find Packet . Under Find select String and under Search In select Packet list . | {
"source": [
"https://serverfault.com/questions/192720",
"https://serverfault.com",
"https://serverfault.com/users/21875/"
]
} |
192,893 | My machine is continously making udp dns traffic request. what i need to know is the PID of the process generating this traffic. The normal way in TCP connection is to use netstat/lsof and get the process associated at the pid. Is UDP the connection is stateles, so, when i call netastat/lsof I can see it only if the UDP socket is opened and it's sending traffic. I have tried with lsof -i UDP and with nestat -anpue , but I can't find wich process is doing that request because i need to call lsof/netstat exactly when the udp traffic is sended, if i call lsof/netstat before/after the udp datagram is sended is impossible to view the opened UDP socket. Call netstat/lsof exactly when 3/4 udp packet is sended is IMPOSSIBLE. How I can identify the infamous process? I have already inspected the traffic to try to identify the sended PID from the content of the packet, but is not possible to identify it from the contect of the traffic. Anyone can help me ? I'm root on this machine FEDORA 12 Linux noise.company.lan 2.6.32.16-141.fc12.x86_64 #1 SMP Wed Jul 7 04:49:59 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux | Linux auditing can help. It will at least locate users and processes making datagram network connections. UDP packets are datagrams. First, install the auditd framework on your platform and ensure that auditctl -l returns something, even if it says that no rules are defined. Then, add a rule to watch the system call socket() and tag it for easy finding later ( -k ). I need to assume that you are on a 64-bit architecture, but you can substitute b32 in place of the b64 if you aren't. auditctl -a exit,always -F arch=b64 -F a0=2 -F a1\&=2 -S socket -k SOCKET You have to pick through man pages and header files to build this, but what it captures is essentially this system call: socket(PF_INET, SOCK_DGRAM|X, Y) , where the third parameter is unspecified but frequently zero. PF_INET is 2 and SOCK_DGRAM is 2. TCP connections would use SOCK_STREAM which would set a1=1 . ( SOCK_DGRAM in the second parameter may be ORed with SOCK_NONBLOCK or SOCK_CLOEXEC , hence the &= comparison.) The -k SOCKET is our keyword we want to use when searching audit trails later. It can be anything, but I like to keep it simple. Let a few moments go by and review the audit trails. Optionally, you could force a couple of packets by pinging a host out on the net, which will cause a DNS lookup to occur, which uses UDP, which should trip our audit alert. ausearch -i -ts today -k SOCKET And output similar to the section below will appear. I'm abbreviating it to highlight the important parts type=SYSCALL ... arch=x86_64 syscall=socket success=yes exit=1 a0=2 a1=2 ... pid=14510 ... auid=zlagtime uid=zlagtime ... euid=zlagtime ... comm=ping exe=/usr/bin/ping key=SOCKET In the above output, we can see that the ping command caused the socket to be opened. I could then run strace -p 14510 on the process, if it was still running. The ppid (parent process ID) is also listed in case it is a script that spawns the problem child a lot. Now, if you have a lot of UDP traffic, this isn't going to be good enough and you'll have to resort to OProfile or SystemTap , both of which are currently beyond my expertise. This should help narrow things down in the general case. When you are done, remove the audit rule by using the same line you used to create it, only substitute -a with -d . auditctl -d exit,always -F arch=b64 -F a0=2 -F a1\&=2 -S socket -k SOCKET | {
"source": [
"https://serverfault.com/questions/192893",
"https://serverfault.com",
"https://serverfault.com/users/57671/"
]
} |
193,059 | I have all of my upstart config files under version control. My ideal way to use upstart is to create soft links from my version control repository (mercurial - not that it matters) into /etc/init but upstart fails to see the jobs. Everything is fine if I copy the files from the repository directory to /etc/init. Anyone know why upstart fails to handle symbolic or even hard links? Thanks Chris | Upstart watches its configuration directories with inotify and reloads the configuration when any of the files change or a new file is added. Apparently this doesn't work for symlinks. To manually update the configuration use $ initctl reload-configuration | {
"source": [
"https://serverfault.com/questions/193059",
"https://serverfault.com",
"https://serverfault.com/users/11207/"
]
} |
193,114 | I'm currently having a major problem with e1000e (not working at all) in Ubuntu Maverick (1.0.2-k4), after resume I'm getting a lot of stuff in dmesg: [ 9085.820197] e1000e 0000:02:00.0: PCI INT A disabled
[ 9089.907756] e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k4
[ 9089.907762] e1000e: Copyright (c) 1999 - 2009 Intel Corporation.
[ 9089.907797] e1000e 0000:02:00.0: Disabling ASPM L1
[ 9089.907827] e1000e 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[ 9089.907857] e1000e 0000:02:00.0: setting latency timer to 64
[ 9089.908529] e1000e 0000:02:00.0: irq 44 for MSI/MSI-X
[ 9089.908922] e1000e 0000:02:00.0: Disabling ASPM L0s
[ 9089.908954] e1000e 0000:02:00.0: (unregistered net_device): PHY reset is blocked due to SOL/IDER session.
[ 9090.024625] e1000e 0000:02:00.0: eth0: (PCI Express:2.5GB/s:Width x1) 00:0a:e4:3e:ce:74
[ 9090.024630] e1000e 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
[ 9090.024712] e1000e 0000:02:00.0: eth0: MAC: 2, PHY: 2, PBA No: 005302-003
[ 9090.109492] e1000e 0000:02:00.0: irq 44 for MSI/MSI-X
[ 9090.164219] e1000e 0000:02:00.0: irq 44 for MSI/MSI-X and, a bunch of [ 2128.005447] e1000e 0000:02:00.0: eth0: Detected Hardware Unit Hang:
[ 2128.005452] TDH <89>
[ 2128.005454] TDT <27>
[ 2128.005456] next_to_use <27>
[ 2128.005458] next_to_clean <88>
[ 2128.005460] buffer_info[next_to_clean]:
[ 2128.005463] time_stamp <6e608>
[ 2128.005465] next_to_watch <8a>
[ 2128.005467] jiffies <6f929>
[ 2128.005469] next_to_watch.status <0>
[ 2128.005471] MAC Status <80080703>
[ 2128.005473] PHY Status <796d>
[ 2128.005475] PHY 1000BASE-T Status <4000>
[ 2128.005477] PHY Extended Status <3000>
[ 2128.005480] PCI Status <10> I decided to compile the latest stable e1000e to 1.2.17 , now I'm getting: [ 9895.678050] e1000e: Intel(R) PRO/1000 Network Driver - 1.2.17-NAPI
[ 9895.678055] e1000e: Copyright(c) 1999 - 2010 Intel Corporation.
[ 9895.678098] e1000e 0000:02:00.0: Disabling ASPM L1
[ 9895.678129] e1000e 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[ 9895.678162] e1000e 0000:02:00.0: setting latency timer to 64
[ 9895.679136] e1000e 0000:02:00.0: irq 44 for MSI/MSI-X
[ 9895.679160] e1000e 0000:02:00.0: Disabling ASPM L0s
[ 9895.679192] e1000e 0000:02:00.0: (unregistered net_device): PHY reset is blocked due to SOL/IDER session.
[ 9895.791758] e1000e 0000:02:00.0: eth0: (PCI Express:2.5GB/s:Width x1) 00:0a:e4:3e:ce:74
[ 9895.791766] e1000e 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
[ 9895.791850] e1000e 0000:02:00.0: eth0: MAC: 3, PHY: 2, PBA No: 005302-003
[ 9895.892464] e1000e 0000:02:00.0: irq 44 for MSI/MSI-X
[ 9895.948175] e1000e 0000:02:00.0: irq 44 for MSI/MSI-X
[ 9895.949111] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 9895.954694] e1000e: eth0 NIC Link is Up 10 Mbps Full Duplex, Flow Control: RX/TX
[ 9895.954703] e1000e 0000:02:00.0: eth0: 10/100 speed: disabling TSO
[ 9895.955157] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 9906.832056] eth0: no IPv6 routers present With 1.2.20 I get: [ 9711.525465] e1000e: Intel(R) PRO/1000 Network Driver - 1.2.20-NAPI
[ 9711.525472] e1000e: Copyright(c) 1999 - 2010 Intel Corporation.
[ 9711.525521] e1000e 0000:02:00.0: Disabling ASPM L1
[ 9711.525554] e1000e 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[ 9711.525586] e1000e 0000:02:00.0: setting latency timer to 64
[ 9711.526460] e1000e 0000:02:00.0: irq 45 for MSI/MSI-X
[ 9711.526487] e1000e 0000:02:00.0: Disabling ASPM L0s
[ 9711.526523] e1000e 0000:02:00.0: (unregistered net_device): PHY reset is blocked due to SOL/IDER session.
[ 9711.639763] e1000e 0000:02:00.0: eth0: (PCI Express:2.5GB/s:Width x1) 00:0a:e4:3e:ce:74
[ 9711.639771] e1000e 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
[ 9711.639854] e1000e 0000:02:00.0: eth0: MAC: 3, PHY: 2, PBA No: 005302-003
[ 9712.060770] e1000e 0000:02:00.0: irq 45 for MSI/MSI-X
[ 9712.116195] e1000e 0000:02:00.0: irq 45 for MSI/MSI-X
[ 9712.117098] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 9712.122684] e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
[ 9712.122693] e1000e 0000:02:00.0: eth0: 10/100 speed: disabling TSO
[ 9712.123142] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 9722.920014] eth0: no IPv6 routers present But, I'm still getting these [ 9982.992851] PCI Status <10>
[ 9984.993602] e1000e 0000:02:00.0: eth0: Detected Hardware Unit Hang:
[ 9984.993606] TDH <5d>
[ 9984.993608] TDT <6b>
[ 9984.993611] next_to_use <6b>
[ 9984.993613] next_to_clean <5b>
[ 9984.993615] buffer_info[next_to_clean]:
[ 9984.993617] time_stamp <24da80>
[ 9984.993619] next_to_watch <5d>
[ 9984.993621] jiffies <24f200>
[ 9984.993624] next_to_watch.status <0>
[ 9984.993626] MAC Status <80080703>
[ 9984.993628] PHY Status <796d>
[ 9984.993630] PHY 1000BASE-T Status <4000>
[ 9984.993632] PHY Extended Status <3000>
[ 9984.993635] PCI Status <10>
[ 9986.001047] e1000e 0000:02:00.0: eth0: Reset adapter
[ 9986.176202] e1000e: eth0 NIC Link is Up 10 Mbps Full Duplex, Flow Control: RX/TX
[ 9986.176211] e1000e 0000:02:00.0: eth0: 10/100 speed: disabling TSO I'm not sure where to start troubleshooting this. Any ideas? Here is the result of ethtool -d eth0 MAC Registers
-------------
0x00000: CTRL (Device control register) 0x18100248
Endian mode (buffers): little
Link reset: reset
Set link up: 1
Invert Loss-Of-Signal: no
Receive flow control: enabled
Transmit flow control: enabled
VLAN mode: disabled
Auto speed detect: disabled
Speed select: 1000Mb/s
Force speed: no
Force duplex: no
0x00008: STATUS (Device status register) 0x80080703
Duplex: full
Link up: link config
TBI mode: disabled
Link speed: 10Mb/s
Bus type: PCI Express
Port number: 0
0x00100: RCTL (Receive control register) 0x04048002
Receiver: enabled
Store bad packets: disabled
Unicast promiscuous: disabled
Multicast promiscuous: disabled
Long packet: disabled
Descriptor minimum threshold size: 1/2
Broadcast accept mode: accept
VLAN filter: enabled
Canonical form indicator: disabled
Discard pause frames: filtered
Pass MAC control frames: don't pass
Receive buffer size: 2048
0x02808: RDLEN (Receive desc length) 0x00001000
0x02810: RDH (Receive desc head) 0x00000001
0x02818: RDT (Receive desc tail) 0x000000F0
0x02820: RDTR (Receive delay timer) 0x00000000
0x00400: TCTL (Transmit ctrl register) 0x3103F0FA
Transmitter: enabled
Pad short packets: enabled
Software XOFF Transmission: disabled
Re-transmit on late collision: enabled
0x03808: TDLEN (Transmit desc length) 0x00001000
0x03810: TDH (Transmit desc head) 0x00000000
0x03818: TDT (Transmit desc tail) 0x00000000
0x03820: TIDV (Transmit delay timer) 0x00000008
PHY type: IGP2 and ethtool -c eth0 Coalesce parameters for eth0:
Adaptive RX: off TX: off
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0
rx-usecs: 3
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 0
tx-usecs: 0
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 0
rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0
rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0 Here is also the lspci -vvv for this controller 02:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
Subsystem: Lenovo ThinkPad X60s
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 45
Region 0: Memory at ee000000 (32-bit, non-prefetchable) [size=128K]
Region 2: I/O ports at 2000 [size=32]
Capabilities: [c8] Power Management version 2
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee0300c Data: 415a
Capabilities: [e0] Express (v1) Endpoint, MSI 00
DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <512ns, L1 <64us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE- FLReset-
DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+
RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 <128ns, L1 <64us
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
AERCap: First Error Pointer: 14, GenCap- CGenEn- ChkCap- ChkEn-
Capabilities: [140 v1] Device Serial Number 00-0a-e4-ff-ff-3e-ce-74
Kernel driver in use: e1000e
Kernel modules: e1000e I filed a bug on this upstream , still no idea how to get more useful information. Here is a the result of the running that script EEPROM FIX UPDATE $ sudo bash fixeep-82573-dspd.sh eth0
eth0: is a "82573L Gigabit Ethernet Controller"
This fixup is applicable to your hardware
Your eeprom is up to date, no changes were made Do I still need to do anything? Also here is my EEPROM dump $ sudo ethtool -e eth0
Offset Values
------ ------
0x0000 00 0a e4 3e ce 74 30 0b b2 ff 51 00 ff ff ff ff
0x0010 53 00 03 02 6b 02 7e 20 aa 17 9a 10 86 80 df 80
0x0020 00 00 00 20 54 7e 00 00 14 00 da 00 04 00 00 27
0x0030 c9 6c 50 31 3e 07 0b 04 8b 29 00 00 00 f0 02 0f
0x0040 08 10 00 00 04 0f ff 7f 01 4d ff ff ff ff ff ff
0x0050 14 00 1d 00 14 00 1d 00 af aa 1e 00 00 00 1d 00
0x0060 00 01 00 40 1f 12 07 40 ff ff ff ff ff ff ff ff
0x0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff 4a e0 I'd also like to note that I used eth0 every day for years and until recently never had an issue. | Please try booting the kernel with the pcie_aspm=off kernel parameter. | {
"source": [
"https://serverfault.com/questions/193114",
"https://serverfault.com",
"https://serverfault.com/users/18822/"
]
} |
193,160 | Which is the default TCP connect timeout in Windows? There is a registry key to configure it or it's set dynamically? | In Windows the value is dynamic for established conections, though the default for initial connections is 72 seconds. The Registry settings are defined in this article: http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx HKEY_LOCAL_MACHINE
\SYSTEM
\CurrentControlSet
\Services:
\Tcpip
\Parameters TcpInitialRTT : Defines what the initial time-out settings are for new connections. This number in seconds is doubled each time it retransmits before timing a connection out. Defaults to 3. TcpMaxConnectRetransmissions : Defines the number of retransmissions while establishing the connection before timing a connection out. Defaults to 2. | {
"source": [
"https://serverfault.com/questions/193160",
"https://serverfault.com",
"https://serverfault.com/users/45617/"
]
} |
193,293 | I thought /bin/sh was a symlink to my shell of choice. I've always used bash , so I assumed that /bin/sh would point to /bin/bash . It turns out, though, that it points to /bin/dash . It gets funnier. I start dash and do echo $SHELL and it prints /bin/bash (so they're basically the same?). However, the man page of dash is completely different from the man page of bash (so they're not the same?). | Debian and Ubuntu switched to dash (iirc) because of a couple of things. First of all, Bash has become big over the years. In fact, the /bin/bash binary on my Ubuntu 8.04 system is almost ten times (!) as big as /bin/dash . Now, that does not matter much for day to day shell use, but it does matter in the following situations: Dash is much smaller and thus loads faster, which is a boon for init-scripts. If you have to start a lot of them, loading Dash instead of Bash each time, speeds things up considerably. Because of the smaller size of Dash, Debian and Ubuntu are able to shave off a pretty big chunk of the size of their initrd, leaving more room for other stuff (and again, speeding things up). The downside of using Dash instead of Bash for scripting, is that a lot of people use syntactical niceties only Bash has, the so-called Bashisms . Examples of Bashisms are substrings, like this: echo $SHELL
/bin/bash
a=1234567890
echo ${a}
1234567890
echo ${a:3}
4567890
echo ${a:3:1}
4 And this: echo ${a#123}
4567890 Dash, on the other hand mainly aims to be POSIX compliant (and no more than that), will give you a Bad substition error if you try this: echo $SHELL
/bin/dash
# actually, it will read /bin/bash above, because if you just run dash
# it will not set the $SHELL variable :)
a=1234567890
echo ${a}
1234567890
echo ${a:3}
dash: Bad substitution This will matter if you use /bin/sh (and therefore dash ) as the interpreter for your shellscripts and use Bashisms in them. Debian and Ubuntu have nice wiki pages about Bashisms and why they are bad in shellscripts in general and init-scripts in particular. Therefore, you should consciously choose whether you need /bin/sh or /bin/bash as the interpreter for your script. Dash is not supposed to be used as the default shell on your systems. Just use Bash for that. For portability of your scripts, you can use Dash as the interpreter to increase the odds the scripts will run on other Linux flavors and Unixes. | {
"source": [
"https://serverfault.com/questions/193293",
"https://serverfault.com",
"https://serverfault.com/users/42849/"
]
} |
193,305 | If I want to use kerberos instead of https (http over ssl) how do I make sure data is not tampered or read in the transit? | Debian and Ubuntu switched to dash (iirc) because of a couple of things. First of all, Bash has become big over the years. In fact, the /bin/bash binary on my Ubuntu 8.04 system is almost ten times (!) as big as /bin/dash . Now, that does not matter much for day to day shell use, but it does matter in the following situations: Dash is much smaller and thus loads faster, which is a boon for init-scripts. If you have to start a lot of them, loading Dash instead of Bash each time, speeds things up considerably. Because of the smaller size of Dash, Debian and Ubuntu are able to shave off a pretty big chunk of the size of their initrd, leaving more room for other stuff (and again, speeding things up). The downside of using Dash instead of Bash for scripting, is that a lot of people use syntactical niceties only Bash has, the so-called Bashisms . Examples of Bashisms are substrings, like this: echo $SHELL
/bin/bash
a=1234567890
echo ${a}
1234567890
echo ${a:3}
4567890
echo ${a:3:1}
4 And this: echo ${a#123}
4567890 Dash, on the other hand mainly aims to be POSIX compliant (and no more than that), will give you a Bad substition error if you try this: echo $SHELL
/bin/dash
# actually, it will read /bin/bash above, because if you just run dash
# it will not set the $SHELL variable :)
a=1234567890
echo ${a}
1234567890
echo ${a:3}
dash: Bad substitution This will matter if you use /bin/sh (and therefore dash ) as the interpreter for your shellscripts and use Bashisms in them. Debian and Ubuntu have nice wiki pages about Bashisms and why they are bad in shellscripts in general and init-scripts in particular. Therefore, you should consciously choose whether you need /bin/sh or /bin/bash as the interpreter for your script. Dash is not supposed to be used as the default shell on your systems. Just use Bash for that. For portability of your scripts, you can use Dash as the interpreter to increase the odds the scripts will run on other Linux flavors and Unixes. | {
"source": [
"https://serverfault.com/questions/193305",
"https://serverfault.com",
"https://serverfault.com/users/57788/"
]
} |
193,319 | The unix find(1) utility is very useful allowing me to perform an action on many files that match certain specifications, e.g. find /dump -type f -name '*.xml' -exec java -jar ProcessFile.jar {} \; The above might run a script or tool over every XML file in a particular directory. Let's say my script/program takes a lot of CPU time and I have 8 processors. It would be nice to process up to 8 files at a time. GNU make allows for parallel job processing with the -j flag but find does not appear to have such functionality. Is there an alternative generic job-scheduling method of approaching this? | xargs with the -P option (number of processes). Say I wanted to compress all the logfiles in a directory on a 4-cpu machine: find . -name '*.log' -mtime +3 -print0 | xargs -0 -P 4 bzip2 You can also say -n <number> for the maximum number of work-units per process. So say I had 2500 files and I said: find . -name '*.log' -mtime +3 -print0 | xargs -0 -n 500 -P 4 bzip2 This would start 4 bzip2 processes, each of which with 500 files, and then when the first one finished another would be started for the last 500 files. Not sure why the previous answer uses xargs and make , you have two parallel engines there! | {
"source": [
"https://serverfault.com/questions/193319",
"https://serverfault.com",
"https://serverfault.com/users/26228/"
]
} |
193,631 | I have some cloud boxes that change their IP frequently. I ssh using the hostname but have to edit the known_hosts file every time the server launches because of this error message: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is… Aside from any security risks and such that are associated with what I want to do, is there a way to either ignore this error or overwrite the known_hosts file automatically such that I don't always have to edit it myself? | Edit your .ssh/config file and add a config for this server: Host frequent-rotation.example.com
CheckHostIP no CheckHostIP defaults to 'yes'. What this does is to do just the kind of check you're failing. Turning it off means it just trusts that the IP is variable, and will to key-checking against the hostname. | {
"source": [
"https://serverfault.com/questions/193631",
"https://serverfault.com",
"https://serverfault.com/users/56130/"
]
} |
193,971 | Is there an easy way to determine if a mounted filesystem is mounted as Read-Only or Read-Write? I was thinking just to pipe mount but I thought there might be an easier way. | This little one-liner will pop-out something if a ro file system exists. grep "[[:space:]]ro[[:space:],]" /proc/mounts Assuming you don't usually have a ro file system like a CD in the drive, it is sufficient for some basic monitoring type stuff and doesn't require changing the file system to find the current state. It also doesn't assume your file system type. Pipe it into grep -v iso9660 if you want to keep your CDs out of the record. | {
"source": [
"https://serverfault.com/questions/193971",
"https://serverfault.com",
"https://serverfault.com/users/21307/"
]
} |
194,295 | I've always done: chown nimmylebby:admins file I see that this also works: chown nimmylebby.admins file Might seem like a silly question but I'm genuinely curious on how the latter works. It isn't documented in my chown's manpage (GNU coreutils 8.4, 10/10). Is this perhaps a Bash interpretation? Or a deprecated format for the argument? | From the chown(8) manpage on Mac OS X version 10.9: COMPATIBILITY Previous versions of the chown utility used the dot (``.'') character to
distinguish the group name. This has been changed to be a colon (``:'')
character, so that user and group names may contain the dot character. | {
"source": [
"https://serverfault.com/questions/194295",
"https://serverfault.com",
"https://serverfault.com/users/53736/"
]
} |
194,402 | If I am using NTP daemon or ntpdate command, do I need to worry about changing the timezone? Should I re-configure the timezone using cron job to guarantee the accuracy of the server time? I am using ubuntu server. | You only need to set the time zone once: tzselect or dpkg-reconfigure tzdata NTP does not handle time zones. All time data handled by NTP is in UTC; your local time zone setting determines the offset from there. | {
"source": [
"https://serverfault.com/questions/194402",
"https://serverfault.com",
"https://serverfault.com/users/58024/"
]
} |
194,567 | My Git setup runs fine on Linux, but when I try to set things up under Windows (using Git for Windows and TortoiseGit ), I don't know where to put my private SSH key (or, better still, how to tell ssh where it's located). I'm using the standard ssh.exe option during installation of Git for Windows. The setup runs fine if I allow password authentication (in lieu of RSA) on the server. | For Git Bash If you are running msysgit (I am assuming you are) and are looking to run Git Bash (I recommend it over TortoiseGit, but I lean to the CLI more than GUI now), you need to figure out what your home directory is for Git Bash by starting it then type pwd (On Windows 7, it will be something like C:\Users\phsr I think). While you're in Git Bash, you should mkdir .ssh . After you have the home directory, and a .ssh folder under that, you want to open PuTTYgen and open the key (.ppk file) you have previously created. Once your key is open, you want to select Conversions -> Export OpenSSH key and save it to HOME\.ssh\id_rsa . After you have the key at that location, Git Bash will recognize the key and use it. Note: Comments indicate that this doesn't work in all cases. You may need to copy the OpenSSH key to Program Files\Git\.ssh\id_rsa (or Program Files (x86)\Git\.ssh\id_rsa ). For TortoiseGit When using TortoiseGit, you need to set the SSH key via pacey's directions . You need to do that for every repository you are using TortoiseGit with. | {
"source": [
"https://serverfault.com/questions/194567",
"https://serverfault.com",
"https://serverfault.com/users/58008/"
]
} |
194,597 | After modified screenrc, how to see the changes without restarting screen? | You could try Ctrl - a : source ~/.screenrc . | {
"source": [
"https://serverfault.com/questions/194597",
"https://serverfault.com",
"https://serverfault.com/users/26731/"
]
} |
194,795 | My application needs to call 'convert' - http://linux.about.com/od/commands/l/blcmdl1_convert.htm But its not present on my redhat system. How / what do I install? | convert is part of the package ImageMagick; try sudo yum install ImageMagick (or other privilege escalation method as appropriate to your system). | {
"source": [
"https://serverfault.com/questions/194795",
"https://serverfault.com",
"https://serverfault.com/users/54725/"
]
} |
194,827 | I would like to write a powershell script that gets the following parameters as input: Folder to copy from, extensions allows, folder to copy to and a boolean indicating if the change should restart IIS, username and password. What cmdlets should I be looking at considering that I am copying to a remote server? How do I read the parameters into variables? How do I restart IIS? Cosidering that I might want to copy multiple folders, how do I write a powershell script that invokes a powershell script? | Get-ChildItem allows you to list files and directories, including recursively with filename filters. Copy-Item allows you to copy a file. There is a lot of overlap in terms of selecting the files, often Copy-Item on its own is sufficient depending on the details of what you need (eg. do you want to retain the folder structure?) To copy all *.foo and *.bar from StartFolder to DestFolder: Copy-Item -path "StartFolder" -include "*.foo","*.bar" -Destination "DestFolder" If you need to preserve the folder structure things get harder because you need to build the destination folder name, something like: $sourcePath = 'C:\StartFolder'
$destPath = 'C:\DestFolder'
Get-ChildItem $sourcePath -Recurse -Include '*.foo', '*.bar' | Foreach-Object `
{
$destDir = Split-Path ($_.FullName -Replace [regex]::Escape($sourcePath), $destPath)
if (!(Test-Path $destDir))
{
New-Item -ItemType directory $destDir | Out-Null
}
Copy-Item $_ -Destination $destDir
} But robocopy is likely to be easier: robocopy StartFolder DestFolder *.foo *.bar /s In the end the way to choose will depend on the details of what's needed. (In the above I've avoided aliases (e.g. Copy-Item rather than copy ) and explicitly use parameter names even if they are positional.) | {
"source": [
"https://serverfault.com/questions/194827",
"https://serverfault.com",
"https://serverfault.com/users/14430/"
]
} |
194,832 | How do I restart, say for example my httpd or afpd, running any Mac OS X >= 10.5 (Leopard-), without having to use the GUI and go to System Preferences -> Sharing and unchecking/checking "Web Sharing"? I'm looking for the canonical equivalent to Debian's invoke-rc.d apache2 restart . EDIT: The question is about launchd controlled services in general , not specifically Apache (-which was simply an example). | launchctl(8) is your friend. Just keep in mind that some of the services (sshd for example) are disabled in the configuration file so you will need to use the -w switch when loading them. Here is a sshd example: $ sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist You can stop the service using the unload subcommand. $ sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist To list the services, as you might have already guessed use the 'list' subcommand ;) | {
"source": [
"https://serverfault.com/questions/194832",
"https://serverfault.com",
"https://serverfault.com/users/3242/"
]
} |
195,221 | How to rename a MySQL database? The MySQL online manual has said about the RENAME DATABASE command (this documentation page has been removed by Oracle some time ago): This statement was added in MySQL 5.1.7 but was found to be dangerous and
was removed in MySQL 5.1.23. So, how to proceed? The rationale: We started with a code name for the project and want the database name now to reflect the definitive name of the project. | From this blog post by Ilan Hazan: In MySQL there is no support for database renaming.
In order to rename a MySQL database you can do one of the following: Create new database and rename all tables in the old database to be in the new database: CREATE database new_db_name;
RENAME TABLE db_name.table1 TO new_db_name.table1, db_name.table2 TO new_db_name.table2;
DROP database db_name; In Linux shell, use mysqldump to back up the old database, then restore the dumped database under a new name using the MySQL utility. Finally, use the drop database command to drop the old database. This option can perform badly for large database. mysqldump -uxxxx -pxxxx -h xxxx db_name > db_name_dump.sql
mysql -uxxxx -pxxxx -h xxxx -e "CREATE DATABASE new_db_name"
mysql -uxxxx -pxxxx -h xxxx new_db_name < db_name_dump.sql
mysql -uxxxx -pxxxx -h xxxx -e "DROP DATABASE db_name" Write a simple Linux script (my favorite solution) #!/bin/bash
dbuser=xxxx
dbpass=xxxx
olddb=xxxx
newdb=xxxx
mysqlconn="mysql -u $dbuser -p$dbpass -h localhost"
$mysqlconn -e "CREATE DATABASE \`$newdb\`"
params=$($mysqlconn -N -e "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='$olddb'")
for name in $params; do
sql="RENAME TABLE \`$olddb\`.\`$name\` to \`$newdb\`.\`$name\`"
echo "$sql";
$mysqlconn -e "$sql";
echo "Renamed $olddb.$name to $newdb.$name";
done;
#$mysqlconn -e "DROP DATABASE \`$olddb\`" If all your tables are MyISAM, you can rename the old database folder name: Shut down the MySQL server, Rename the database folder name to the new name, Start the MySQL server. | {
"source": [
"https://serverfault.com/questions/195221",
"https://serverfault.com",
"https://serverfault.com/users/27634/"
]
} |
195,306 | I'm having a performance problem in a site we've made, and I'm not exactly sure how to start diagnosing it. The short description is: We have a very small site ( http://hearablog.com ) with very little traffic, in a crappy dedicated server, CPU is always very high, sometimes it stays at 100% for minutes, and w3wp.exe is taking most of it. A typical scenario is w3wp.exe takes 60%, and SQL Server takes about 30%.
Our DB is pretty small too. Long description and more details: The site is hosted in a very crappy server by Cari.Net. From the beginning we had the feeling that the server didn't quite behave correctly, like some things would take just too long, so this could be a configuration problem from the get go. It may also be that we are getting a virtual server while we're supposed to have a dedicated one, although we have no evidence that'd indicate this, except for the fact that the server tends to be quite slow. The server is Windows 2008 Standard 64-bit, with SQL 2008 Express Hardware is a Celeron 2.80 GHz, 1Gb RAM The website is developed in ASP.Net MVC, using Entity Framework for data access. Now, this is pretty crappy hardware, but i've had other servers with these guys, with equivalent (or worse) HW, and performance is much better than this one. That said, the other servers have W2003 and SQL2005, and I'm using ASP.Net "WebForms" 2.0, no MVC, no LINQ, no EF; so I'm not sure whether going to 2008 / the other stuff means a big performance penalty is expected. I'm serving MP3 files (5-20 Mb) regularly, which is a slightly unusual load, maybe that is causing some kind of problems? Would that cause w3wp to use a lot of CPU? Disk usage seems very low. Memory is usually around 90%, but disk usage seems to indicate it's not paging much. I get tons of e-mails every day about SQL timeouts, for queries taking over 30 seconds, although all our queries are pretty straightforward (or should be, but EF may be screwing it up). This is what resource monitor looks like in one of these "sprints" of 100% CPU, in case there's anything useful there. And a snapshot of some performance counters: Now, what confuses me very much is that CPU usage of w3wp is just so high.
It shouldn't be doing much really...
So my questions are... Is there any way of finding out "what" it is doing? Maybe even profile it? Any performance counters I should be looking at? Is this to be expected given this hardware/software configuration? Is this could be cause by some kind of configuration failure, where would you start looking? Thank you VERY much. Daniel Magliola | You can also use the Worker Processes UI inside IIS Manager and inspect the requests that are currently executing and see where they are getting stuck if any.
Open IIS Manager->Click the Server in the Tree->Double Click Worker Processes Icon->Double click the Worker Process that is consuming CPU to see the currently executing requests in real time so that you can see which module is taking time. Also consider using Failed Request Tracing to track some of the time per request to see where they are taking long time. | {
"source": [
"https://serverfault.com/questions/195306",
"https://serverfault.com",
"https://serverfault.com/users/1168/"
]
} |
195,328 | Could someone please describe to me the pros and cons of using a Unix socket file vs a tcp/ip localhost:port when setting up services on a server (Ubuntu, FWIW)? In this particular instance it's for a Python WSGI server (uWSGI) but I'm just interested in general (eg, I know you can set up MySQL in both ways). I realise that using tcp/ip means that the services can be exposed to other machines, but I'm just interested in whether there are any performance tradeoffs when accessing services locally. Cheers. | Unix sockets are a little bit faster as you don't have the tcp-overhead. If you realize this performance loss is a question of server load. If you don't have very high server load you won't recognize it. If you use Jails (FreeBSD) or some other virtualisation technology to separate the e.g. MySQL-Server from the Webserver, you often use the tcp/ip setup instead of sockets. The firewall rules need to restrict the access though. You need to find out if your system is under heavy load so that a socket is a must or you can focus on a nice system design (separating services), then a tcp/ip solution would be better. So make a long answer short: Yes, there is a performance difference, sockets are faster. If you are not suffering high server load, just choose what fits better to your system's design. | {
"source": [
"https://serverfault.com/questions/195328",
"https://serverfault.com",
"https://serverfault.com/users/58436/"
]
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.