In Python, os.makedirs() with 0777 mode can not give others write permission The code is as follows $ python Python 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2 Type “help”, “copyright”, “credits” or “license” for more information. >>> import os >>> os.makedirs(“/tmp/test1/test2”, 0777) >>> The created dirs are not
Read more
Tag: X
Cannot make directory ‘/var/run/screen/S-apache’: Permission denied
Posted onHello! Im trying to create a screen folder for the user apache, Not root. But it seems to fail, I have no idea on how to fix this issue. I only get the error: Cannot make directory ‘/var/run/screen/S-apache’: Permission denied Im using Cent OS 7 There may be various possible reasons. 2 common reasons: screen
Read more
How to send a POST request in Go?
Posted onHow to send a POST request in Go? For example, send a POST of content like ‘id=8’ to a URL like https://example.com/api. In Go, the http package provides many common functions for GET/POST. Related to POST requests, the package provides 2 APIs: Post Post issues a POST to the specified URL. func (c *Client) Post(url,
Read more
How to use encfs on Windows 10?
Posted onI am happy using encfs on Linux. But how to use encfs on Windows 10? I would suggest EncFS MP. It support Encfs on Windows. Features of EncFSMP: Mounts EncFS folders on Windows and OS X Can create, edit, export and change the password of EncFS folders Is 100% compatible with EncFS 1.7.4 on Linux
Read more
How to Debug a Bash script?
Posted onHow to debug a Bash script if it has some bugs? Common techniques like printing varibles out for checking apply for bash too. For bash, I also use 2 bash-specific techniques. Use errexit option Run the script with -e option like bash -e your-script.sh or add set -o errexit to the beginning of the script.
Read more
How to get the one character’s next character in ASCII table in Bash?
Posted onHow to get the one character’s next character in ASCII table in Bash? For example, if I have ‘a’ in variable i, how to get ‘b’? First, we need to get the integer value for the character. char=’b’ charint=$(printf “%d” “‘$char'”) Then, we increase the integer by one let charint=$charint+1 Last, we can get the
Read more
Ubuntu’s GUI response is very slow
Posted onFor Dell PowerEdge T630 server, if you install latest Ubuntu desktop version (16.04) or (14.04), you will get a very slow GUI (X-window). $ inxi -G Graphics: Card: Matrox Systems G200eR2 X.org: 1.15.1 driver: vesa tty size: 205×58 Advanced Data: N/A out of X For Ubuntu 14.04.1, this problem can be solved by following steps.
Read more
How to use the xargs argument twice in the command on Linux?
Posted on`xargs` passes the argument once to the utility command specified. For example, xargs cat will cat every line passed to xargs. But how to use the xargs argument twice in the command on Linux? For example, to rename file to file.bak where file is from the stdin. One solution is to write a small script like
Read more
How to enable SSH service on Fedora Linux?
Posted onHow to enable SSH service on Fedora Linux? By default, it seems ssh is not enabled. Fedora may not have sshd service installed/enabled by default. You will need to install and configure it by yourself. The following instructions is for Fedora 22 as an example. First, install the sshd server by # dnf install openssh-server
Read more
How to change the display manager on Fedora Linux?
Posted onThe default display manager on my Fedora 22 is gdm. If I would like to change it to other display manager like KDM, LightDM or other, which is the portable and reliable method? You can use the “system-switch-displaymanager” tools to manage the display manager. This is possibly the most portable way. To install it: #
Read more
How to make Fedora Linux not clean some files in /tmp/?
Posted onOn my Fedora 20, I find that the system automatically clean up file under /tmp/. This is convenient. However, it cause some problems for some programs. For example, HDFS puts its DataNode pid file under /tmp/ by default like hadoop-hadoop-datanode.pid. After it is cleaned up, the hadoop-daemon.sh script will consider there is no DataNode running.
Read more
How to make AdSense responsive ads show rectangle ads instead of horizontal ones?
Posted onI noticed that many sites with AdSense responsive ads show large rectangle ads (336px x 280px) or large rectangle text ads (full width x 280px). However, in my own website (640px width content area), it shows most of time horizontal ones. How to make AdSense responsive ads show rectangle ads instead of horizontal ones? At
Read more
I cannot login Ubuntu Precise desktop
Posted onI cannot login desktop in Ubuntu Precise. It told me following errors: Could not write bytes: Broken Pipe… Check Battery Satte Actually, I tried many ways to solve this problem. It seems that something wrong with my lightdm software so, at last, I use gdm software to replace lightdm to kill this problem. Just install
Read more
How to configure interface bonding in Linux?
Posted onHow to configure interface bonding to bound to 2 eth interfaces together in Linux, specifically CentOS/RHEL? This tutorial Configuring Interface Bonding on CentOS/RHEL/OEL 6.x introduces setting up interface bonding well on CentOS / RHEL / OEL 6.
Any good Web browser in command line in Linux?
Posted onWhat suggested web browser in command line? This will be very useful for browsing the Internet from a command line via SSH. You may use Lynx, a fully-featured World Wide Web (WWW) client for users running cursor-addressable, character-cell display devices, in Linux. Homepage: http://lynx.isc.org/ Lynx is a fully-featured World Wide Web (WWW) client for users
Read more
How to make CentOS 6.6 power off the console screen automatically?
Posted onOn CentOS 6.6, I find that it can make the screen (console, not X) blank after a while. However, it does not power the screen off. This usually work on Fedora or other releases. I guess this is caused by some configurations specific in CentOS 6.6. How to make CentOS 6.6 power off the console
Read more
How to upgrade packages installed by ELPA in Emacs?
Posted onELPA manages packages for Emacs nicely. But, how to upgrade packages installed by ELPA in Emacs? Within Emacs, list all packages by M-x list-packages and it will automatically refresh the archive contents. Then, press U to mark all upgradable packages to be upgraded. Last, press x to perform the new updates. Emacs will then download
Read more
How to make Alt key work in xterm?
Posted onAlt key seems not work in xterm. Alt is important for Emacs. How to make Alt key work in xterm? Put this in your ~/.Xresources file: XTerm*eightBitInput: false XTerm*eightBitOutput: true Remember to make it take effect after you change the ~/.Xresource without restarting the X server by xrdb -merge ~/.Xresources
How to kick off a user on a Linux box?
Posted onI want to kick off a user such as “bob” on a Linux box which I managed remotely. How to do this? bob may log on the Linux box by various ways: Log on the screen on the Linux box (locally) with a X server. Log on remotely by a ssh shell. Log on by
Read more
How to install latest version of Calibre?
Posted onHow to install latest version of Calibre? The version from my distro (Ubuntu, Linux Mint, Fedora) seem at 1.xx while the latest Calibre is already at 2.x. You may check Caibre website’s instruction: http://calibre-ebook.com/download_linux sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c “import sys; main=lambda:sys.stderr.write(‘Download failedn’); exec(sys.stdin.read()); main()”