Hot answers tagged

122

Some commands (eg chown) can accept either a username or a numeric user ID, so allowing all-numeric usernames would break that. A rule to allow names that start with a number and contain some alpha was probably considered not worth the effort; instead there is just a requirement to start with an alpha character. Edit: It appears from the other responses ...


74

here is a test on ubuntu 14.04 using numbers: root@ubuntu:~# useradd 232 root@ubuntu:~# mkdir /home/232 root@ubuntu:~# chown 232.232 /home/232 root@ubuntu:~# passwd 232 Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@ubuntu:~# login c2 login: 232 Password: Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 4.4.0-22-...


9

A *Nix username is generally a 32 character long string created by the utility useradd. This is, as you said, a direct result of early Unix (BSD technically) standards. According to the FreeBSD Man Page passwd(5): The login name must not begin with a hyphen (`-'), and cannot contain 8-bit characters, tabs or spaces, or any of these symbols: ...


9

eudyptula-boot is quite handy for this; its introductory blog post has more details, but basically it allows you to boot a VM using the kernel you wish to test, and your existing filesystems (using overlayfs). That way you can quickly check a kernel without rebooting, and you still have access to all your files. The only requirement on the kernel being ...


6

When you write the command line parsing bit of your code, you specify what options take arguments and which ones do not. For example, in a shell script accepting an -h option (for help for example) and an -a option that should take an argument, you do opt_h=0 # default value opt_a="" while getopts 'a:h' opt; do case $opt in h) opt_h=1 ;; ...


5

You don't have a tempfile2.gz you only have a tempfile2. Decompress by doing gzip -d < tempfile2 > tempfile3 Normally gzip would expect a .gz file for decompression and so you can do mv tempfile2 tempfile2.gz gzip -d tempfile2.gz which would give you an uncompressed tempfile2. Or you could do mv tempfile2 tempfile2.gz gzip -cd tempfile2.gz &...


5

curl wont "wait" to interpret your Javascript because curl does not understand JavaScript; JavaScript is always done on the client side, and usually browsers have JavaScript engines/know how to run JavaScript. So curl will see it only as block as text, and leave it as it is. Please do note this behaviour is not unique to curl e.g. in the Linux command line,...


5

Looks like you're confusing Mb/s (megabit per second) with MB/s (megabyte per second). 1000 Mb/s becomes a theoretical 125 MB/s, and 120 MB/s looks like good performance (since you don't give more information, I take that it is a standard desktop PC with SATA hard disks). Besides, I don't really think you can reach 1 GB/s (which would mean 8 Gb/s) without ...


5

apt-get install whois Requires a network connection that can see the kali repo at http://http.kali.org/


5

Logfiles are plain text files, and each line is appended at the end. So there is no loss of data when using non-UTC timezone. Of course, you may view the files using a tool which can get confused. However, the usual reason for using UTC is to avoid ambiguity: you do not have to know what the local timezone is to interpret the data. So yes, using UTC in ...


5

When troubleshooting problems with daemons, you should always check the system logs. In this particular case, if you check your system logs on the NAS host, you'll see something similar to: Authentication refused: bad ownership or modes for directory /home/admin The problem is shown in this output: admin@NAS:~$ ls -alh drwxrwxrwx 6 admin users 4.0K Jun ...


5

I'm not sure if you're trying to convert lower to upper or remove lower all together. Give this a shot for the lower to upper conversion. tr [:lower:] [:upper:] < ws2.txt To trim out lowercase chars you can use sed sed -e 's/[a-z]//g' ws2.txt Or you can use tr as suggested by @fd0 tr -d '[:lower:]' < ws2.txt To trim out numbers and capital ...


4

Don't rely on wildcard matching / shell globbing but instead use the find command to find and list the files you want and send that list to tar to be archived: find /A/ -type f -print0 -name \*.log | tar -cvf /path/to/file.tar --null -T -


4

This is possible. You want to investigate Ctrl-R and a little bit of history expansion. From man bash: reverse-search-history (C-r) Search backward starting at the current line and moving 'up' through the history as necessary. This is an incremental search. History expansions introduce words from the history list into the input ...


4

Not exactly what you are asking for, but you can search through the history. Eg, ^R followed by ssh and then continue cycling through commands with ^R. (That's reverse search. Forward search is by default at ^S but that unfortunately collides with XOFF (undone with ^Q) for the typical terminal, so you probably want to remap that for it to be useful.)


4

You can't. It's now in the pool as a single-drive vdev. vdevs can not be removed from a pool. That's the bad news. The worse news is that you've now effectively got a RAID-0 with your raidz2-0 vdev and the c2t13d0 vdev. This is NOT good. It's doubleplusungood. Your options are: to live with the pool you have created backup, destroy and re-create the ...


4

This proves yet again that if you run random scripts off the Internet, you lose. Who wrote that tutorial? More importantly, who wrote this "iRedMail" thing? (never heard of it). Did you review the script, so that you're sure it didn't do anything else wrong? In the best case, that script (I didn't review it) simply has a bug which caused it to set ...


4

The MBR partition format is three decades old, and subject to weirdness for historical reasons. Back then, the computer needed to know the geometry of the hard disk. How is data organized on a hard disk? In three dimensions: cylinder, heads and sectors. (Diagram by LionKimbro) The geometry was stored with maximum values that were large enough for the ...


4

Try running watch netstat -i while traffic is flowing. The active interface will have increasing counters. The command netstat -rn may give you some more information. I would expect traffic to flow on the interface with the lowest irtt value.


4

It shows ? since there is no TTY (terminal interface) to which this process is attached. This is fortunate since sshd is a system daemon and should not be dependent on a client session. As mentioned in the comments, closing a session will terminate all related processes for that TTY, which is not desired for system wide processes.


3

No. It doesn't make sense to say the first version of Linux in particular was "based on parts of" Unix. It was not a port of the Unix kernel. It did not start with Unix code in the first versions [browse source] and replace it over time. Linus did not have access to Unix source code [interview]. What it copied from is the API. The same API is in the ...


3

There is nothing abnormal about having tmpfs filesystems in your Linux box. tmpfs is a memory only filesystem, much like the "RAM disks" of other operating systems. As the name implies, the content lives in RAM, so it goes away after a reboot. It is also extremely fast. tmpfs is commonly used in situations where you don't care about the contents of a ...


3

You are confusing filesystem (organization) semantics with partition (storage) semantics. Linux filesystem hierarchy is like a single giant tree with a stem (/) , branches ( /boot, /home, /bin, /usr, /var ) and sub-branches ( /usr/bin, /var/log ...). This metaphor is equivalent of the parents, children and grandchildren. All these symbols/names ...


3

The crontab entry you've written is equivalent to 0 0-23/12 * * * . /X.sh This requests execution on the hour between midnight and 11pm, using 12-hour steps — so cron will run the job every day at midnight and noon.


3

You might do this: echo "$DF" | awk '$NF == "/var" || $NF == "/" { print $(NF-2) }' or if you want to use a regex, use the ~ regex matching operator: echo "$DF" | awk '$NF ~ "^(/var|/)$" { print $(NF-2) }' or: echo "$DF" | awk '$NF ~ "^/(var)?$" { print $(NF-2) }'


3

Give grep with Perl Compatible REgexp module a try: to remove two-letters combinations: pcregrep -Mv '>.*\n([ACGT])\1*([ACGT])\2*(\1|\2)*$' file output: >NB501013:9:HJJ75BGXX:4:21602:19346:16945/2 CTCGTCGCATCACAAAGGGAT >NB501013:9:HJJ75BGXX:3:11407:17650:13229/2 CCGCGGGCCGGTGCGGGGGTTTTTTTGTTTTTTTGGTTACAACGGGTGGG >NB501013:9:HJJ75BGXX:3:...


3

You can try running # udevadm trigger Or restart the udev daemon.


3

I don't have tomcat, but it should be the same as for apache, which I tried as follows (you probably only need to replace httpd by tomcat everywhere). Simply create an new systemd httpd.service file in /etc which includes and overrides part of the one in /lib. For example, create /etc/systemd/system/httpd.service to contain .include /lib/systemd/system/...


3

The terminology is “file mode bits” as per chmod(1), and “octal mode” for the numeric version. The “mode” specifies the permissions of a file. The POSIX API chmod(3p) refers to them as “file permission bits”.


3

You can use strace to figure out what files a program is using. For example: strace -f -o top.log -e trace=file top Then just press q to quit top. A file top.log has been created that shows which files top did access while it was running. Essentially, it seems to be /proc/<pid>/{stat,statm} for the PIDs of all running processes, and the following ...



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