Vim opens file even if the user does bot have write permission to the file. But after revision, how to write file content with sudo in Vim if Vim reports no permission to write the file. Use this command inside of vim to write to the file with sudo: :w !sudo tee % Here, !
Read more
Tag: permission
Why I cannot login remote server with its root
Posted on# ssh root@192.168.122.96 root@192.168.122.96’s password: Permission denied, please try again. Do according to [1]. NOTE: on Ubuntu, remember to restart ssh service like this “sudo restart ssh”. [1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/v2v_guide/preparation_before_the_p2v_migration-enable_root_login_over_ssh
How to get one process’s port number?
Posted onIf we want to check one program on one remote server, we need to know this server’s IP and port number. How to get this program’s port number in the remote server? # netstat -tulpn Remember to run this program with root permission since some programs can only be accessed by root.
In Python, `os.makedirs()` with 0777 mode does not give others write permission
Posted onIn 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
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
encfs on CentOS 6 can’t mount as normal user
Posted onOn CentOS 7, using a normal user, encfs works just well. On CentOS 6, using the root user, encfs works. However, the problem is, on CentOS 6, using a normal user account, encfs does not work as on CentOS 7. $ encfs -s ~/t/.enc ~/t/enc EncFS Password: fuse: failed to exec fusermount: Permission denied fuse
Read more
Allowing root Access to NFS Directories
Posted onFor local filesystems, root usually has full access (read/write) to directories/files inside of it. But for NFS directory mounted from network, root usually has no permission to write to directories or files within the NFS directory. How to make root act similarly in an NFS directory to the behavior in local directories? The reason that
Read more
Linux boots failed with “sulogin: can not open password database” while the /etc/passwd and /etc/shadow files look fine
Posted onLinux boots failed with “sulogin: can not open password database” while the /etc/passwd and /etc/shadow files look fine. How to fix this? The OS is Fedora 22. You may try this trick Step 1: boot Linux with rw init=/bin/bash following this tutorial. Step 2: after Linux booted, disable SELinux following this tutorial. Reboot. If it
Read more
How to run screen on a Linux host reporting “Cannot make directory ‘/var/run/screen’: Permission denied”?
Posted onI want to run screen on a remote host on which I do not have root/sudo privilege and screen is not installed. I can compile or copy the screen program that can run on the host. However, it reports: “Cannot make directory ‘/var/run/screen’: Permission denied” As screen is not installed on the host, the directory
Read more
How to redirect STDOUT of sudo command on Linux and write to file as root?
Posted onA try like the following command failed $ sudo echo “echo hello” > /usr/local/bin/hello with an message bash: /usr/local/bin/hello: Permission denied It seems the writing to the file is executed under the non-root user. How to redirect STDOUT of sudo command on Linux and write the content to the file (/usr/local/bin/hello here) as root? You
Read more
Bash comparison operators
Posted onWhat are all the bash supported comparison operators? The man 1 test contains all the operators supported in bash. An omitted EXPRESSION defaults to false. Otherwise, EXPRESSION is true or false and sets exit status. It is one of: ( EXPRESSION ) EXPRESSION is true ! EXPRESSION EXPRESSION is false EXPRESSION1 -a EXPRESSION2 both EXPRESSION1
Read more
How to Change the DPI of Images Exported from Slides in PowerPoint
Posted onPowerPoint uses 96 dots per inch (dpi) by default when you export a slide. The DPI of the images like .tif ones exported from PowerPoint are always 96. In the options of PowerPoint, there is a setting for choosing DPIs. However, it have no effect. For some needs like images for printing posters, larger DPIs
Read more
Unified Linux Login and Home Using OpenLDAP and NFS
Posted onIn this post, how to unified Linux login and home directory using OpenLDAP and NFS/automount will be introduced. 0. System environment This solution is tested on Fedora 12 systems and CentOS 5. LDAP and NFS server: IP: 10.0.0.2 OS: Fedora 12 x86_64 ldap base dn: “dc=lgcpu1″ Clients: IP: 10.0.0.1/24 OS: Fedora 12 x86_64 1. LDAP
Read more
How to Set Up and Configure NFS Server and Clients
Posted onNFS is widely deployed and used even after more than twenty year. NFS is easy to set up and easy to use. This introduces how to set up the NFS server and clients. We use the Fedora system as the example. The tutorial here is for RHEL/CentOS/Fedora and derived Linux OSes. Set up an NFS
Read more
How to Get System Uptime on Linux and Windows OSes
Posted onHow to find out Linux and Windows uptime is introduced in this post. Linux uptime Linux uptime can be easily found out by the uptime command: $ uptime 22:19:29 up 10 days, 22:26, 5 users, load average: 0.00, 0.00, 0.00 The system is up for 10 days, 22 hours and 26 minutes. uptime gives a
Read more
NVIDIA Driver in Linux not Displaying Logo During Booting
Posted onThe NVIDIA video card driver in Linux will display the NVIDIA logo by default during booting the X server after we successfully installed the driver. If we don’t like to see the logo every time we start X server, we can disable it. We need to edit the Xorg configuration file /etc/X11/xorg.conf with root permission.
Read more
How to Backup Linux Home Directories Using rsync
Posted onI need to backup my Linux home directory to one of my portable hard disk. I tried to use git, but failed since git doesn’t support large file (I failed after many tries, I have file larger than 5G). I find rsync, the fast, versatile, remote (and local) file-copying tool and I am happy with
Read more
How to Set Up Password-less SSH Login on Linux
Posted onAutomatic passwrod-less ssh login can make our life easier. To enable this, we have 2 options: using key-based authentication by copying our SSH public keys to the remote machines for automatic password-less login or using password-based authentication. I will introduce the 2 options in the post. Before you start, please note that key-based authentication is
Read more
Howto: Git Server over SSH
Posted onGit and SSH are both powerful tools, and git/ssh work well together. We introduce how to set up git server via ssh in this post. Git server through SSH is easy and fast to set up, although every user will have access to all repositories in the git server over SSH and every user is
Read more