vagrant synced_folder file permissions - centos

Vagrant Version 1.6.3
Virtual Box 4.3.12
VBoxGuestAdditions-4.3.2
Host OS -> Windows 8
Guest OS -> CentOS 6.4
This is the content of my Vagrantfile ( where developer is userName )
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www"
# # comments-> I tried many combinations
# :owner=> 'developer',
# :group=> 'developer'
# :mount_options=> ['dmode=777', 'fmode=777']
Now when I try to change the access permissions of the synced_folder(/var/www) or sub directories or files of synced_folder by chmod command,the result is not as expected
For example
1) vim testFile.php
2) ls -al testFile.php
-rwxrwxrwx 1 developer developer 12 Sep 23 15:52 testFile.php
3) chmod 700 testFile.php
-rwxrwxrwx 1 developer developer 12 Sep 23 15:52 testFile.php
4) chmod 000 testFile.php
-r-xr-xr-x 1 developer developer 12 Sep 23 15:52 testFile.php
5) chmod 111 testFile.php
-r-xr-xr-x 1 developer developer 12 Sep 23 15:52 testFile.php
6) chmod 077 testFile.php
-rwxrwxrwx 1 developer developer 12 Sep 23 15:52 testFile.php
Basically the file is always readable and executable by "owner" , "group" and "others".
The question is why it is so ? Is there any solution for this? I want the synced_folder to behave according to centOS access permissions.
I am really stuck here for past few days.Please help.
Thank you

The guest OS normally preserves host's persmissions. Try adding permissions for other users on Windows.

Related

Git hook command has seriously messed with my directory listings

Got this line of code in .git/hooks/post-checkout:
exec vim +PackerCompile +"sleep 100m" +qall
The vim command ran fine from the command line. But apparently, not so well in sh.
When I switch to a branch, I get a very messy output:
Switched to branch 'clean'
Your branch is up to date with 'origin/clean'.
Vim: Warning: Input is not from a terminal
Even worse, my directory listings are all screwy:
> $ ls -la [±clean ✓]
total 4
drwxr-xr-x 6 user staff 192 Feb 26 20:59 .
drwxr-xr-x 5 user staff 160 Feb 26 16:39 ..
drwxr-xr-x 3 user staff 96 Feb 26 16:55 .compiled_packer_config
drwxr-xr-x 5 user staff 160 Feb 26 20:59 lua
drwxr-xr-x 19 user staff 608 Feb 20 16:56 templates
-rw-r--r-- 1 user staff 279 Feb 26 20:59 init.lua
It looks like I've got some whitespace characters in there. These whitespace characters are showing up in all directories in this terminal. In other terminals, things display normally. But WTF happened? And how do I fix?
OK, I stuck with what I'm more familiar with and used bash. Works just fine:
#!/bin/zsh
#exec git update-server-info
bash -c '/usr/local/bin/nvim +PackerCompile +"sleep 100m" +qall'

CentOs 7, "Tesseract couldn't load any languages!" however: "List of available languages (2): eng, spa"

this is CentOs 7
when I run tesseract --list-langs
[root#cia tessdata]# tesseract --list-langs
Error opening data file /usr/local/share/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
List of available languages (2):
eng
spa
[root#cia tessdata]#
however when I run
[root#cia tessdata]# ls -l /usr/local/share/tessdata/
total 328
drwxr-xr-x. 2 root root 4096 Nov 17 23:28 configs
-rw-r--r--. 1 root root 164228 Nov 18 06:11 eng.traineddata
-rw-r--r--. 1 root root 572 Nov 17 23:28 pdf.ttf
-rw-r--r--. 1 root root 157745 Nov 18 06:11 spa.traineddata
drwxr-xr-x. 2 root root 98 Nov 17 23:28 tessconfigs
[root#cia tessdata]#
I get eng.traineddata and spa.traineddata in this form:
cd /usr/local/share/tessdata
wget https://github.com/tesseract-ocr/tessdata/blob/main/eng.traineddata
wget https://github.com/tesseract-ocr/tessdata/blob/main/spa.traineddata
:::::::::::::::::::::::::::::::::::::::::::
allways I install languages with:
wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/master/spa.traineddata
then allways tesseract work fine, but now this return 404
how I can fix?

Has anyone tried using the bitbake-env utility lately?

Has anyone tried using the bitbake-env utility lately?
I do not see it installed:
[user#localhost build]$ which bitbake
~/YOCTO/oe_core_embedded/poky/bitbake/bin/bitbake
[user#localhost build]$ which bitbake-env
/usr/bin/which: no bitbake-env in (/home/user/YOCTO/oe_core_embedded/poky/scripts:/home/user/YOCTO/oe_core_embedded/poky/bitbake/bin:/usr/libexec/python2-sphinx:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/user/.local/bin:/home/user/bin)
[user#localhost build]$
As well I do not see it in the bitbake command listing:
[user#localhost poky]$ cd bitbake/bin
[user#localhost bin]$ ls -al
total 100
drwxrwxr-x. 2 user user 4096 Oct 18 12:49 .
drwxrwxr-x. 6 user user 4096 Oct 18 12:49 ..
-rwxrwxr-x. 1 user user 2072 Nov 18 11:51 bitbake
-rwxrwxr-x. 1 user user 7228 Oct 18 12:49 bitbake-diffsigs
-rwxrwxr-x. 1 user user 2894 Oct 18 12:49 bitbake-dumpsig
-rwxrwxr-x. 1 user user 4069 Oct 18 12:49 bitbake-layers
-rwxrwxr-x. 1 user user 2109 Oct 18 12:49 bitbake-prserv
-rwxrwxr-x. 1 user user 2128 Oct 18 12:49 bitbake-selftest
-rwxrwxr-x. 1 user user 17866 Oct 18 12:49 bitbake-worker
-rwxrwxr-x. 1 user user 13951 Oct 18 12:49 bitdoc
-rwxrwxr-x. 1 user user 5813 Oct 18 12:49 git-make-shallow
-rwxrwxr-x. 1 user user 8805 Oct 18 12:49 toaster
-rwxrwxr-x. 1 user user 4177 Oct 18 12:49 toaster-eventreplay
[user#localhost bin]$
It still exists/is listed in https://elinux.org/Bitbake_Cheat_Sheet from July 2016.
bitbake-env is a third party utility, and not actually a part of the OpenEmbedded Core hence why you will not see it unless you specifically install it. It is actually an 'improved' version of the bitbake -e flag for bitbake.
bash-4.3$ bitbake --help
Usage: bitbake [options] [recipename/target recipe:do_task ...]
Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
will provide the layer, BBFILES and other configuration information.
Options:
...
-e, --environment Show the global or per-recipe environment complete
with information about where variables were
set/changed.

Effective user id does not change after making the file owned by root

I'm currently reading a book on programming with C, I got to a part where I've got to write a program which will display the real uid and effective uid that the file is being executed on. After compiling the code with gcc, I input the command to see the current uOwner and gOwner ls- l id_demo the output is this:
-rwxrwxr-x 1 user user 8629 Sep 21 13:04 id_demo
I then execute the program itself, this is what I get:
real uid: 1000 effective uid: 1000
...so far so good. I then input a command to change the owner of the file:
sudo chown root:root ./id_demo
The ls -l confirms that the owner has been changed to root:
-rwxrwxr-x 1 root root 8629 Sep 21 13:04 id_demo
Again, executing the program shows real uid and uid as 1000. The last step after which the uid must be 0 is this: sudo chmod u+s ./uid_demo but for me they stay as 1000, where in the book the output is clearly show to be this:
real uid: 1000
effective uid: 0
Any ideas why is this happening?
UPDATE
id_demo source code:
#include <stdio.h>
int main ()
{
printf("real uid: %d\n", getuid());
printf("effective uid: %d\n", geteuid());
}
UPDATE 2
Screen shots
PLEASE HELP. I'm going crazy I spent 6+hour looking for the solution and I need to move on.
We've figured it out. The cause is an ecryptfs-mounted home directory. The mount output contains the following line:
/home/evgeny/.Private on /home/evgeny type ecryptfs
That means that the home directory isn't actually part of the root filesystem (that has the necessary suid flag), but its own virtual filesystem that apparently doesn't support setuid binaries by default. I have successfully reproduced the issue with a test user that has an encrypted home directory.
It is possible to add the suid flag to the ecryptfs with the following command:
sudo mount -i -o remount,suid /home/evgeny
I'm not certain though how safe that is, nor how to change it permanently so that it would survive reboots.
This works for me:
compile
$ gcc uid_demo.c -o uid_demo
$ ll
total 12
-rwxrwxr-x 1 saml saml 6743 Sep 21 17:05 uid_demo
-rw-rw-r-- 1 saml saml 116 Sep 21 16:58 uid_demo.c
chown
$ sudo chown root:root uid_demo
$ ll
total 12
-rwxrwxr-x 1 root root 6743 Sep 21 17:05 uid_demo
-rw-rw-r-- 1 saml saml 116 Sep 21 16:58 uid_demo.c
chmod
$ sudo chmod u+s uid_demo
$ ll
total 12
-rwsrwxr-x 1 root root 6743 Sep 21 17:05 uid_demo
-rw-rw-r-- 1 saml saml 116 Sep 21 16:58 uid_demo.c
run
$ ./uid_demo
real uid: 500
effective uid: 0

Cannot build source code in Xcode 4.1 with iOS 4.3.5 device

I have been developing in Xcode 4.1 with iphone of iOS 4.3.5. It was fine without a version mismatch problem. Today, I connected another iphone which has the same version of iOS (4.3.5) and I could not build source code on to the device. The organizer window said,
The version of iOS on “Hee’s iPhone” does not match any of the
versions of iOS supported for development with this installation of
the iOS SDK. Please restore the device to a version of the OS listed
below, or update to the latest version of the iOS SDK; which is
available here.
I know it will be solved if I update Xcode or downgrade iPhone. However, I want to know other options if there are any. I really wonder why some devices are fine but others are not.
You can put additional SDKs/Symbols for the iPhoneOS/iPhoneSimulator platforms inside:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/[insert ios version folder here]
and
/Developer/Platforms/iPhoneOS.platform/DeviceSupport/[insert ios version folder here]
What I do is download old xcode and new beta xcode, install them to something like /Developer-3.2.3/, then symlink/alias the folders above from the /Developer-3.2.3 to the /Developer.
This lets my 4.1 xcode test on an iOS5.0 phone! The directory paths above might not be exact as I am writing this from my phone but they areaomething close to that. When I get back to my computer I will make sure those directories are correct.
For the simulator versions it would be:
/Developer/Platforms/iPhoneSimulator.platform/SDK/...
Edit (back at my computer):
Here is what my Developer directories looks like:
[ 17:49 root#MacBookPro / ]# ll
drwxrwxr-x+ 44 root admin 1.5K Sep 20 12:37 Applications
drwxrwxr-x 15 root admin 510B Sep 20 13:27 Developer
drwxrwxr-x# 17 root admin 578B Sep 20 13:12 Developer-3.2.4
drwxr-xr-x# 10 root admin 340B Sep 20 13:54 Developer-3.2.5
drwxrwxr-x# 18 root admin 612B Sep 20 13:44 Developer-4.2-beta7
[ 17:46 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/Developer/SDKs ]# ll
lrwxr-xr-x 1 root wheel 75B Sep 20 13:53 iPhoneOS3.2.sdk -> /Developer-3.2.4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk
drwxr-xr-x 8 root wheel 272B Sep 20 13:26 iPhoneOS4.3.sdk
lrwxr-xr-x 1 root wheel 79B Sep 21 12:50 iPhoneOS5.0.sdk -> /Developer-4.2-beta7/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
[ 17:46 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/Developer ]# cd ../../DeviceSupport/
[ 17:46 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ll
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.0
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.1
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.1.2
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.1.3
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.2
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.2.1
drwxrwxr-x 5 root admin 170B Sep 20 13:26 3.2.2
drwxrwxr-x 5 root admin 170B Sep 20 13:26 4.0
drwxrwxr-x 5 root admin 170B Sep 20 13:26 4.0.1
drwxrwxr-x 5 root admin 170B Sep 20 13:26 4.0.2
drwxrwxr-x 5 root admin 170B Sep 20 13:26 4.1
drwxrwxr-x 5 root admin 170B Sep 20 13:26 4.2
drwxrwxr-x 5 root admin 170B Sep 20 13:26 4.3
lrwxr-xr-x 1 root admin 77B Sep 21 12:54 5.0 (9A5313e) -> /Developer-4.2-beta7/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A5313e)/
lrwxr-xr-x 1 root admin 13B Sep 21 12:54 Latest -> 5.0 (9A5313e)
[ 17:46 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]#
In order to do this, you need to install the different versions of Xcode that have different iOS SDKs. To achieve the above, I only installed Xcode 3.2.4, 3.2.4, 4.1, and 4.2 (beta). I use 4.1 as my main /Developer directory.
Once each Xcode is installed into seperate locations, this is how you would symlink the Symbols/SDKs directories from a non-primary Xcode install to your main install path:
/Developer/Platforms/iPhoneOS.platform/DeviceSupport
[ 17:54 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport
[ 17:54 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ln -sf "/Developer-4.2-beta7/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A5313e)/" "5.0 (9A5313e)"
[ 17:54 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# cd ../Developer/SDKs
[ 17:54 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ln -sf "/Developer-3.2.4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk" "iPhoneOS3.2.sdk"
[ 17:54 root#MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ln -sf "/Developer-4.2-beta7/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" "iPhoneOS5.0.sdk"
After symlinking each SDK/Symbol directory in your main /Developer/Platforms/iPhoneOS.platform/DeviceSupport and /Developer/Platforms/iPhoneOS.platform/Developer/SDKs directories, open up Xcode, and you should be able to see your device and use it to test builds, etc.
Edit 2 (commands explained):
ll is an alias I made for the ls -l command:
[ 18:07 root#MacBookPro / ]# alias
cd..='cd ..'
cls='clear'
df='/usr/local/bin/df.nawk'
du='du -L'
l='ls -lsG'
ldir='ls -d */'
ll='ls -lhG'
ls='ls -G'
lsdir='ls -d */'
text='open -a TextWrangler'
v='ls -lhG'
vi='vim'
vu='vim'
vv='du . --max-depth=1 -L | sort -n | cut -f2 | xargs -d "\n" du -sh -L'
xcode='open -a xcode'
ln (symlink) is a command to create a shortcut/alias. The (very basic) syntax is:
[ 18:07 root#MacBookPro / ]# ln -s [TARGET_PATH] [LINK_NAME]
Here is the ln man page
Here is the ls man page