When I create new file in Midnight commander and save it (Shift+F4, write something, F2, name the file), it is created with 640 pemissions even thought my umask is set to 0007 so it should be created with permissions 660. Is there any secret place to set the mc umask? I did not found one.
In order to use your umask, you should deactivate "Preserve permissions" option.
For more information check the man and search umask:
Preserve attributes
determines whether to preserve the permissions, timestamps and (if you
are root) the ownership of the original files. If this option is not
set, the current value of the umask will be respected.
mc is executed by your user, hence the umask to create a new file will be the default umask configured in ~/.bashrc .
In order to setup the umask 0007, edit your ~/.bashrc and add the line:
umask 0007
After that, relaunch mc and test the creation of a new file.
I tested this settings above in a docker container on debian jessie and works fine.
You can find more details about umask here:
http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html
Related
Location of MySQL configuration file (ie: my.cnf) not specified
How can I fixed this thing?
I been trying to reinstall mysqlserver 5.5 / 5.7 and workbench countless of time. But I still not able to fix this issue.
I solved this problem. Step one: click here
Step two: and then click here to choose your path
Step three: my path is C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
If you already know where your configuration file is located, but just don't know how to specify it in mySQLWorkbench, you can skip steps 1-3 and just follow step 4 in these instructions.
Step 1: Make sure which mysql is running (just in case you have multiple installations on your system) and how:
$ ps aux | grep mysql
may result in something like:
_mysql 120 0,0 3,4 5122736 565108 ?? Ss Fr01pm 61:05.93 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid
If, in this output, you see that mysqld has been started with the --defaults-file option, that option specifies the configuration file used by msql. If so, you have found the configuration file and can skip to step 4.
If not, check if this returns the same binary location as above command:
$ which mysqld
If not, then make sure you use the full path for mysqld from the first output in the following step.
Step 2: Ask mySQL which configuration files it is using:
$ mysqld --verbose --help | grep -A 1 "Default options"
should output something like:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
Step 3: Check the given locations in that order. The first finding should be your mySQL configuration file.
Step 4: In mySQLWorkbench go to Database > Manage Connections, then select the connection, select tab System Profile, and enter the path and file name in Configuration File.
This should be it.
And if still nothing happens, you may have used the installer Package. If you have, then you must select the Installation Type from the drop-down to reflect that before you locate the configuration file.
Here's a screenshot that follows from the above screenshots
Also, there may not be a config file and you can create one here, then get out of the Options File, go back in and you will see all the options.
I changed my setting from Custom to MacOSx (MySQL Package) under: Database → Manage Connections → MySQL Connections → Select DB Connection → System Profile → Installation Type → (default setting) MySQL Package.
Change from custom to default setting:
Reconnect by testing connection:
For maria-db users
back up the original /etc/mysql/my.cnf
copy and rename /etc/mysql/mariadb.conf.d/50-server.cnf to /etc/mysql/my.cnf.
This would fix the problem.
Remember to revert changes after finish.
For those with Mac OS Catalina:
I did not have a my.cnf file. I went to /usr/local/mysql/
and created a directory named etc, which I did not have either.
Then, inside that directory, I created the file (my.cnf).
This is the link that helped me How to fix --secure-file-priv option error
for mysql 5.7 users and MAMP: just create /etc/my.cnf
macOS 13 and MySQL 8 current:
Open MySQL Workbench on your Mac. Connect into your localhost instance of MySQL.
Click the little wrench icon next to INSTANCE on the left pane above Startup / Shutdown.
Select macOS as System Type, macOS as Installation Type, and the rest will default into place. Copy the location it gives you for the my.cnf file.
Click Close
Now click Options File on the left. It will notice that you don't have a file and will show you default values.
Click the Apply... in the bottom right corner.
It will then ask you for a password of your current logged in user of your Mac to create and save the my.cnf file.
Now in the Finder use the keyboard combo of Command-Shift-G and copy in your location we copied early (i.e. /etc/my.cnf)
I've added some proxy settings in google-chrome.desktop:
sudo gedit /usr/share/applications/google-chrome.desktop
by adding them to each "Exec" entry (there are three):
Exec=/usr/bin/google-chrome-stable %U --proxy-server="localhost:3128" --proxy-bypass-list="localhost,127.0.0.1"
But: With each update of Chrome (and there are a lot...) these settings are overwritten. Is there a way to persist the proxy settings, making them survive an update?
Current workaround: I set the proxy settings with this command:
sudo sed -i.bak '/^Exec\=/ s/$/ \-\-proxy\-server\="localhost\:3128" \-\-proxy\-bypass\-list\="localhost\,127\.0\.0\.1"/' /usr/share/applications/google-chrome.desktop
Warning: This doesn't check if there's already a --proxy... declared in the processed lines. However -i.bak creates a backup of the file ;)
I'm trying to create an RPM in Fedora 15 that will install my software, but in order for my software to work correctly once installed, I also need to edit other (configuration) files on the system, add users/groups, etc. Performing some of these tasks is only allowed by the root user. I know to never create an RPM as the root user, and I understand why that is such a bad idea. However, if I add shell script statements to my spec file (%post, %prep... any section) to edit the necessary files, add users/groups, etc., my rpmbuild command fails with message "Permission denied" (not surprisingly).
What's the best way to handle this? Do I have to tell my users to install my package first, and then perhaps run a shell script as root to configure it all? That doesn't seem very elegant. I was hoping to allow a user to do everything with one simple command such as 'yum install mysoftware'.
Much of my research suggests that perhaps this shouldn't even be done via RPM. I've read many parts of Maximum RPM, and lots of other good resources, but haven't found what I'm looking for. I'm new to creating RPMs, but have already been able to successfully create a simple spec file for my software... I just can't get everything configured properly after the package is unzipped and installed to the correct location. Any input is greatly appreciated!
useradd should be run in %pre and shouldn't run during rpmbuild. That's the standard way of doing it. I would recommend the packaging guidelines and specifically the section on users and groups.
The %pre section of your RPM .spec file should check for all the conditions necessary for your software to install.
The %post section of your RPM .spec file should make all the modifications needed for your software to run.
To avoid file permission errors in the %post section of your RPM .spec file, you can set the file permissions and ownership in the %files section. That way, the user who installs the RPM has the appropriate permissions to modify the configuration files.
%install
# Copy files to directories on your installation server
%files
# Set file permissions and ownership on your installation server
%attr(775, myuser, mygroup) /path/to/my/file
%pre
# Check if custom user 'myuser' exists. If not, create it.
# Check if custom group 'mygroup' exists. If not, create it.
# All other checks here
%post
# Perform post-installation steps here, like editing other (configuration) files.
echo "Installation complete."
If Mercurial does not track file permissions by default, how does it decide on the permissions for any files/directories it creates?
Does it use umask? If not, what does it use?
I have read in the mail list the following:
Mercurial uses the mode of the .hg/store directory to compute a mask
but this seems a bit arbitrary (if there is any explanation behind it, I'd love to hear it). Is this explained in the documentation?
There doesn't seem to be any complete explanation, only a mention of it in the "How To Handle Multiple Committers" page:
If you are using a version of Mercurial older than 1.0, it's important that each user's umask be set to 002 or something similar. If it's set to 022, group write privileges will be masked off for files that users create, causing other users to be unable to modify them.
You can change the default umask for a user by editing their ~/.profile and adding the line...
umask 002
Alternatively, you can edit /etc/profile to change the system-wide settings.
Changing the /etc/profile will not work if people check in stuff with the hg command, as that file isn't read by non-interactive shells, /etc/bash.bashrc is a better place to put the system-wide settings.
Otherwise since Mercurial 1.0, the default permission is inherited from .hg/store.
I'm working with a MySQL query that writes into an outfile. I run this query once every day or two and so I want to be able to remove the outfile without having to resort to su or sudo. The only way I can think of making that happen is to have the outfile written as owned by someone other than the mysql user. Is this possible?
Edit: I am not redirecting output to a file, I am using the INTO OUTFILE part of a select query to output to a file.
If it helps:
mysql --version
mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (x86_64) using readline 5.2
The output file is created by the mysqld process, not by your client process. Therefore the output file must be owned by the uid and gid of the mysqld process.
You can avoid having to sudo to access the file if you access it from a process under a uid or gid that can access the file. In other words, if mysqld creates files owned by uid and gid "mysql"/"mysql", then add your own account to group "mysql". Then you should be able to access the file, provided the file's permission mode includes group access.
Edit:
You are deleting a file in /tmp, with a directory permission mode of rwxrwxrwt. The sticky bit ('t') means you can remove files only if your uid is the same as the owner of the file, regardless of permissions on the file or the directory.
If you save your output file in another directory that doesn't have the sticky bit set, you should be able to remove the file normally.
Read this excerpt from the man page for sticky(8):
STICKY DIRECTORIES
A directory whose `sticky bit' is set becomes an append-only directory, or, more accurately, a directory in which the deletion of files is restricted. A file in a sticky directory may only be removed or renamed by a user if the user has write permission for the directory and the user is the owner of the file, the owner of the directory, or the super-user. This feature is usefully applied to directories such as /tmp which must be publicly writable but should deny users the license to arbitrarily delete or rename each others' files.
Not using the "SELECT...INTO OUTFILE" syntax, no.
You need to run the query (ie client) as another user, and redirect the output. For example, edit your crontab to run the following command whenever you want:
mysql db_schema -e 'SELECT col,... FROM table' > /tmp/outfile.txt
That will create /tmp/outfile.txt as the user who's crontab you've added the command to.
I just do
sudo gedit /etc/apparmor.d/usr.sbin.mysqld
and add
/var/www/codeigniter/assets/download/* w,
and
sudo service mysql restart
And that's it, I can do easily SELECT INTO OUTFILE any filename
If you have another user run the query from cron, it will create the file as that user.