You may not connect to sshd on LineageOS because of wrong /data permissions:
sshd: Authentication refused: bad ownership or modes for directory /data
- Navigate to your LineageOS 14.1 source dir
- Open file
external/openssh/misc.c
- Find function
safe_path
and comment out this code block:
/*
if (stat(buf, &st) < 0 ||
(!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) ||
(st.st_mode & 022) != 0) {
snprintf(err, errlen,
"bad ownership or modes for directory %s", buf);
return -1;
}
*/
- Rebuild
Already fixed in the latest version using ifdef statments:
https://github.com/LineageOS/android_external_openssh/blob/lineage-18.1/misc.c#L1929